You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🐛 Bug Report
In the v12 of NodeJS, they changed the list of enumerable globals. Most notably
process
andBuffer
are no longer enumerable. So this makes tests fail if global mock implementations use any of them.To Reproduce
Steps to reproduce the behavior:
Upgrade to the latest node:
> npm install -g node
Create a test file
test.js
like:npx jest ./test.js
This will fail with
Expected behavior
It is expected for jest to know about globals.
Run
npx envinfo --preset jest
Paste the results here:
System: OS: macOS Mojave 10.14.4 CPU: (4) x64 Intel(R) Core(TM) i7-6660U CPU @ 2.40GHz Binaries: Node: 12.1.0 - /usr/local/bin/node Yarn: 1.15.2 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm npmPackages: jest: file:../../../node_modules/jest => 24.8.0
Suggested fix
I can suggest a quick and fair IMO fix. In https://github.com/facebook/jest/blob/master/packages/babel-plugin-jest-hoist/src/index.ts instead of
do
A PR #8429 submitted.
Quick workaround
For referencing
process
orBuffer
in mock, you can useglobal
likeThe text was updated successfully, but these errors were encountered: