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
globalThis is not defined on Node 10 #2961
Comments
Update: I've found what is polyfilling |
Use Jest built-in jsdom environment if jsdom/jsdom#2961 was fixed.
* Upgrade dependent packages to the latest version * Bump @marp-team/marpit to v1.6.2 * Update cache key for CircleCI * Setup globalThis shim * Revert "Setup globalThis shim" This reverts commit 805ed16. * Apply workaround for JSDOM with Node 10 * Re-run `yarn upgrade --latest` * Downgrade JSDOM for Jest environment to 15 Use Jest built-in jsdom environment if jsdom/jsdom#2961 was fixed. * [ci skip] Update CHANGELOG.md * [ci skip] Update CHANGELOG.md
got the same issue on my angular blog was using "jsdom": "^16.2.2" and node 10, all went smoothly after updating node to 12 |
Jest 26 dropped support for Node 8. While Node 10 is still supported, there's a bug with jsdom (jsdom/jsdom#2961).
otherwise, node 10 is broken on CI. see jsdom/jsdom#2961 for details.
755: Temp fix for failing node v10 r=bidoubiwa a=bidoubiwa This fixes the failing tests until this has changed jsdom/jsdom#2961 Tests were failing because of the latest version of `JSdom` that introduced this bug: jsdom/jsdom#2961. We only have the bug now as we have updated jest to its latest version. Multiple solutions are considerable: - Adding a resolution to a previous version of jsdom which works with yarn but not npm - Add a polyfill for globalThis - Remove node 10 from test until resolved: loilo/livy@83de8b1 - Change the JsDom version used by explicitly telling so in jest config (which is kinda what `create-react-app` (85k stars) did but [without using an external library](https://github.com/facebook/create-react-app/pull/8955/files#diff-2f231dbdc363c929e899c94ae0d999f9886fdc6e33fb88d498a6b101a4bf9f68R62)) I went for the last option. Another thing to consider is that [Node 10 is almost EOL](https://github.com/nodejs/Release) (end of life) We might consider dropping support in the futur <img width="986" alt="Screenshot 2021-01-19 at 16 57 25" src="https://user-images.githubusercontent.com/33010418/105059332-7413e100-5a77-11eb-8845-48edc3c24382.png"> Co-authored-by: Charlotte Vermandel <charlottevermandel@gmail.com>
The solution to this is to use this library https://www.npmjs.com/package/jest-environment-jsdom which creates a jest jsdom environment with the version jsdom from any jest version. For example, by using jest-environment-jsdom version 25, you will use the jsdom from this version. And in jest 25, the jsdom version was still compatible with node 10
// jest config
displayName: 'dom',
testEnvironment: 'jest-environment-jsdom', |
Issue on Jest jsdom/jsdom#2961 globalThis in Node.js nodejs/node#22835
Issue on Jest jsdom/jsdom#2961 globalThis in Node.js nodejs/node#22835
Issue on Jest jsdom/jsdom#2961 globalThis in Node.js nodejs/node#22835
Node v10 is no longer supported by jsdom, so closing. |
We're currently running into issues upgrading Create React App to use the latest versions of Jest and jsdom (26 and 16 respectively). When running our test suite on Node 10.20.1, we receive this error:
After digging in with @SimenB, we discovered that it appears to potentially be caused by a core-js polyfill of
globalThis
(we're still investigating if we can work around in some way).Here is a repro as copied from @SimenB's comment here: #2795 (comment) (thanks for digging into the issue with me Simen!)
The text was updated successfully, but these errors were encountered: