-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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 27: tests fail on node 10 related to globalThis
#10957
Comments
I assume this is jsdom/jsdom#2961 |
I have a question, why |
are you sure it doesn't? E.g. try setting runner to jasmine and see if you get the error. If it's only on circus I'll need a reproduction to look into it. You say you cannot reproduce on your own machine? |
aw, my mistake. It worked with |
There is a stalled PR fixing it: jsdom/jsdom#2975 |
globalThis
globalThis
There seems to be no workaround as far I tried, even with jsdom 15. The only way now I can think of is postponing Jest 27 support for |
IIRC it was TypeScript which added the global, so maybe you can copy what CRA does to work around it? https://github.com/facebook/create-react-app/pull/8955/files#diff-2f231dbdc363c929e899c94ae0d999f9886fdc6e33fb88d498a6b101a4bf9f68R62 Sorta weird it works for you on v26 tho, as that's what CRA upgraded to when it got the errors |
ye I dont know why it has been always working with v26. Still no luck with the solution from CRA. |
BREAKING CHANGE - Node 10 won't work due to jsdom bug, see jestjs/jest#10957. If you have errors with node 10 related to `globalThis`, workaround for now is switching to node 12. - Since default `testRunner` in Jest 27 is `jest-circus`, `async` test with `done` callback no longer works, see discussion at jestjs/jest#10529. If you want to have `async` test with `done` callback, please use `testRunner: 'jest-jasmine2'` in your jest config.
So this workaround https://github.com/thymikee/jest-preset-angular/blob/master/src/utils/reflect-metadata.ts#L15 used to work with jest 26 but not with jest 27 |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
On Node 10, tests failed with error related to
globalThis
To Reproduce
For some reasons I cannot reproduce on my Mac, but it happened to CI. See https://github.com/thymikee/jest-preset-angular/pull/676/checks?check_run_id=1570469726
Steps to reproduce the behavior:
yarn
yarn test:e2e
Related PR thymikee/jest-preset-angular#676
Expected behavior
Should not throw error related to
globalThis
, like Node 12 and Node 14.Link to repl or repo (highly encouraged)
https://github.com/ahnpnl/jest-preset-angular/tree/jest-27
envinfo
cc @SimenB @thymikee
The text was updated successfully, but these errors were encountered: