Skip to content
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

Merged
merged 4 commits into from
Feb 17, 2020
Merged

Jest 25 #346

merged 4 commits into from
Feb 17, 2020

Conversation

ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Feb 6, 2020

Summary

Jest 25 compatible.
Closes #344
Closes #325

Test Plan

  • CI green
  • No dependency warning

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@@ -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`.
Copy link
Owner

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.

Copy link
Collaborator Author

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.

Copy link
Owner

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

Copy link
Collaborator Author

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>

Copy link
Owner

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

Copy link
Collaborator

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!

Copy link
Collaborator Author

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 :)

Copy link
Collaborator

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!

Copy link
Owner

@thymikee thymikee left a 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 :)

@thymikee thymikee merged commit 8475b05 into thymikee:master Feb 17, 2020

```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:
Copy link
Owner

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 :)

Suggested change
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:

@ahnpnl ahnpnl deleted the jest-25 branch February 21, 2020 11:13
ahnpnl added a commit that referenced this pull request Feb 21, 2020
suggested by @thymikee from #346
@ahnpnl ahnpnl mentioned this pull request Feb 21, 2020
thymikee pushed a commit that referenced this pull request Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility with Jest 25 Remove jsdom v15 environment once jest v25 is out
3 participants