Scripts: Upgrade Jest to the new major version (26.x) #22395
Labels
[Status] In Progress
Tracking issues with work in progress
[Tool] Jest preset
/packages/jest-preset-default
[Tool] WP Scripts
/packages/scripts
[Type] Breaking Change
For PRs that introduce a change that will break existing functionality
Jest v26.0.0 was released:
https://jestjs.io/blog/2020/05/05/jest-26
We should update our packages to use the latest version. It has a few breaking changes as noted in the announcement post. One of them was already addressed in #22370 by @aduth:
We might need more tweaks but only by looking at changelog, I couldn't identify anything obvious that would create issues. We will find out during the process :)
Bonus tasks
There are also some new features or breaking changes scheduled for the next major releases that could be addressed as a follow-ups:
New fake timers – https://jestjs.io/blog/2020/05/05/jest-26#new-fake-timers:
It feels like the option based on the config file would be easier (assuming it works out of the box).
New way to consume Jest -
@jest/globals
– https://jestjs.io/blog/2020/05/05/jest-26#a-new-way-to-consume-jest---jestglobalsNew test runner "
jest-circus
" and Node.js env enabled by default – we will need to decide if we follow or keep JSDOM as a default one (*):jest-environment-jsdom
needs to become an explicit dependency:(*) - there is this issue filed #17273 which would be resolved if we would set the default testing env to Node.js: "Add integration test which ensures that npm packages can be used with Node" :)
References
It might be helpful to look at previous PR where major version upgrade for Jest was applied: #20766. The changes included:
Note: when migrating from Jest 24 to 25, we rewrote several failing tests covering React components to use React Testing Library rather than Enzyme.
The text was updated successfully, but these errors were encountered: