Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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