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

refactor(preset): explicitly define jsdom for test environment #621

Merged
merged 1 commit into from
Nov 10, 2020
Merged

refactor(preset): explicitly define jsdom for test environment #621

merged 1 commit into from
Nov 10, 2020

Conversation

ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Nov 10, 2020

Summary

Jest 27 sets default test environment to node, see jestjs/jest#9874. Since we need jsdom so we need to explicitly set it in jest-preset.js.

Jest 27 will still bundle jest-environment-jsdom in the main package and Jest 28 will separate them. However, we should just go ahead and set explicitly jest-environment-jsdom in our dependencies list.

More information see https://jestjs.io/blog/2020/05/05/jest-26

Test plan

Green CI

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

N.A>

@ahnpnl ahnpnl marked this pull request as ready for review November 10, 2020 14:29
jest-preset.js Outdated
@@ -11,6 +11,7 @@ module.exports = {
},
},
},
testEnvironment: 'jest-environment-jsdom-sixteen',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't latest Jest using jsdom v16?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reasons, my latest push isn't affected

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good now :)

Jest 27 sets default test environment to `node`. Since we need `jsdom` so we need to explicitly set it in `jest-preset.js`.

Jest 27 will still bundle `jest-environment-jsdom` in the main package and Jest 28 will detach them. However, we should just go ahead and set explicitly `jest-environment-jsdom` in our dependencies list

More information see https://jestjs.io/blog/2020/05/05/jest-26
@ahnpnl ahnpnl merged commit ef0057f into thymikee:master Nov 10, 2020
@ahnpnl ahnpnl deleted the jsdom-env branch November 10, 2020 14:44
@ahnpnl ahnpnl added this to the 9.0.0 milestone Nov 10, 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.

2 participants