-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade JSDOM to 15.2.1 #12704
upgrade JSDOM to 15.2.1 #12704
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,7 +181,7 @@ | |
"isomorphic-fetch": "^2.2.1", | ||
"jest": "^23.6.0", | ||
"jest-image-snapshot": "^2.7.0", | ||
"jsdom": "^11.1.0", | ||
"jsdom": "^15.2.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what I was trying to accomplish with this PR. All other changes are to adapt to changes/problems introduced by this upgrade. Mostly just changing how certain document properties are mocked so that we can override and spy on them in tests. |
||
"json2csv": "^4.2.1", | ||
"jsonschema": "^1.1.1", | ||
"libxmljs": "^0.19.5", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ import sinon from 'sinon'; | |
import { MhvTermsAndConditions } from '../../containers/MhvTermsAndConditions'; | ||
|
||
describe('<MhvTermsAndConditions>', () => { | ||
let oldLocation; | ||
|
||
const props = { | ||
location: { | ||
pathname: '/health-care/medical-information-terms-conditions', | ||
|
@@ -30,14 +32,20 @@ describe('<MhvTermsAndConditions>', () => { | |
}; | ||
|
||
const setup = () => { | ||
global.window.location.replace = sinon.spy(); | ||
oldLocation = global.window.location; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes to JSDOM prevent us from directly overriding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we could set |
||
delete global.window.location; | ||
global.window.location = { replace: sinon.spy() }; | ||
props.acceptTerms.reset(); | ||
props.fetchLatestTerms.reset(); | ||
props.fetchTermsAcceptance.reset(); | ||
}; | ||
|
||
beforeEach(setup); | ||
|
||
afterEach(() => { | ||
global.window.location = oldLocation; | ||
}); | ||
|
||
it('should show an error when there are errors', () => { | ||
const newProps = set('errors', { code: 404 }, props); | ||
const wrapper = shallow(<MhvTermsAndConditions {...newProps} />); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,18 @@ export default function setupJSDom() { | |
|
||
win.dataLayer = []; | ||
win.scrollTo = () => {}; | ||
win.sessionStorage = {}; | ||
Object.defineProperty(win, 'sessionStorage', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
value: global.sessionStorage, | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
}); | ||
Object.defineProperty(win, 'localStorage', { | ||
value: global.localStorage, | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
}); | ||
win.requestAnimationFrame = func => func(); | ||
win.matchMedia = () => ({ | ||
matches: false, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step was failing in Jenkins, as described here. Bumping the RAM allowance the same way we do for our unit tests, makes things happy.