-
Notifications
You must be signed in to change notification settings - Fork 306
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
Jest 25 #346
Jest 25 #346
Conversation
@@ -476,7 +475,7 @@ Reference: https://github.com/facebook/jest/issues/708 | |||
By default we use JSDOM v15, which requires Node v8+. If you want to use Node in a lower version to run your tests, make sure to configure jest to use an older JSDOM version, either in your `jest.config.js`, `jest.config.json` or `package.json`: | |||
|
|||
```json | |||
"testEnvironment": "jsdom" | |||
"testEnvironment": <jsdom_environment_package_<_15> | |||
``` | |||
|
|||
If you use JSDOM v11 or lower, you might have to mock `localStorage` or `sessionStorage` on your own or using some third-party library by loading it in `setupFilesAfterEnv`. |
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.
Can we remove paragraphs about JSDOM that are no longer necessary? Jest comes with JSDOM v15 now. If we want to guide users to use newer one, let's update the messaging.
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.
hmm I think indeed the paragraph is not necessary anymore. What I intended was to provide a fallback user guide but do we need a fallback anymore ? If we don't need, we can just remove the entire paragraph.
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.
On the other hand there's jsdom@16 that Jest 25 can't use, because it dropped Node 8. So the small reference can still be helpful to guide users too. But shouldn't be too lengthy
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.
I propose:
Configure other JSDOM versions
If you want to use another JSDOM version, either in your jest.config.js, jest.config.json or package.json:
"testEnvironment": <jsdom_environment_package>
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.
That's too vague, people will be confused. Let's use concrete example: https://www.npmjs.com/package/jest-environment-jsdom-sixteen
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.
Yeah, referencing the current version seems a good approach here.
Btw, if you could also remove the testEnvironment
line from the exposed config in README.md
would be awesome!
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.
I think it has been removed already :)
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.
Oh yeah, sorry about that!
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.
LGTM. Let's followup with the README updates and have it merged :)
|
||
```json | ||
"testEnvironment": "jsdom" | ||
If you need a newer JSDOM than the one that ships with Jest, install this package using npm install --save-dev jest-environment-jsdom-sixteen or yarn add jest-environment-jsdom-sixteen --dev, and edit your Jest config like so: |
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.
Feel free to send a followup :)
If you need a newer JSDOM than the one that ships with Jest, install this package using npm install --save-dev jest-environment-jsdom-sixteen or yarn add jest-environment-jsdom-sixteen --dev, and edit your Jest config like so: | |
If you need a newer JSDOM than the one that ships with Jest and run Node >=10, you can install `jest-environment-jsdom-sixteen` package, and edit your Jest config like so: |
Summary
Jest 25 compatible.
Closes #344
Closes #325
Test Plan
Checklist
README.md
CHANGELOG.md
example/App.js
)