Skip to content

Commit

Permalink
Upgrade Jest to v28 (#126)
Browse files Browse the repository at this point in the history
This PR upgrades Jest from v27 to v28. Most of the breaking changes don't affect us, except for two:
- To use the JSDOM test environment, `jest-environment-jsdom` now has to be installed separately. But, this means a newer version of `jsdom` is used, which assumes there is a global `TextEncoder`, that is not provided by `jest-environment-jsdom`. This issue is fixed by re-exporting Node `util`'s `TextEncoder` as `global.TextEncoder` in `setup-env.ts`
- Jest now has full support for package exports, which can cause problems where file imports are not resolved correctly. Specifically, this is a problem for `uuid`. There is a discussion and proposed solution in this [GitHub issue](microsoft/accessibility-insights-web#5421 (comment)), which I used in this PR. To summarize, the fix is to add a custom resolver that forces Jest to use the CommonJS+node version of `uuid`, but leaves all other resolutions the same

J=SLAP-2123
TEST=auto

See that Jest tests pass.
  • Loading branch information
nmanu1 committed Jun 7, 2022
1 parent 65127b8 commit 9313517
Show file tree
Hide file tree
Showing 4 changed files with 6,526 additions and 2,494 deletions.

0 comments on commit 9313517

Please sign in to comment.