Repository navigation
jest error in Node version over 11.11 #6591
Description
PS. I do not speak English well. Please understand.
Is this a bug report?
Yes
Did you try recovering your dependencies?
yes / Initialized project with npx create-react-app my-project
Which terms did you search for in User Guide?
jest, jest version
Environment
$ npx create-react-app --info
npx: installed 63 in 8.392s
Environment Info:
System:
OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Binaries:
Node: 11.11.0 - ~/.nvm/versions/node/v11.11.0/bin/node
Yarn: 1.13.0 - /usr/bin/yarn
npm: 6.7.0 - ~/.nvm/versions/node/v11.11.0/bin/npm
npmPackages:
react: ^16.8.4 => 16.8.4
react-dom: ^16.8.4 => 16.8.4
react-scripts: 2.1.8 => 2.1.8
npmGlobalPackages:
create-react-app: Not Found
Steps to Reproduce
- install node version 11.11. (only over 11.11. There is no problem with other versions.)
- npx create-react-app myproject && cd myproject
- yarn test # this step error
Expected Behavior
Currently, the LTS version of node.js is 10, but will change from 2019-04-01 to version 11. That's why I think we need to fix the problem.
This problem has been fixed as follows after jestjs/jest@800f2f8 (v24.2.0-alpha.0).
newProcess[Symbol.toStringTag] = 'process';
modify to
try {
// This fails on Node 12, but it's already set to 'process'
newProcess[Symbol.toStringTag] = 'process';
} catch (e) {
// Make sure it's actually set instead of potentially ignoring errors
if (newProcess[Symbol.toStringTag] !== 'process') {
e.message =
'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' +
e.message;
throw e;
}
}
I used the 10.15.3 node and tried the 24.3.0 Jest. As a result, it worked fine. But I have not tested it for other versions of the node.
Actual Behavior
$ CI=true yarn test
yarn run v1.13.0
$ react-scripts test
FAIL src/App.test.js
● Test suite failed to run
TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<process>'
at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 3.291s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The same is true without "CI=true".
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Activity
Lock version
LesterLyu commentedon Mar 7, 2019
same here.
jmarlow4 commentedon Mar 7, 2019
I'm getting the same error
viktorlarsson commentedon Mar 8, 2019
Experiencing the same on node@latest, downgrading to node 10.6.0 makes everything fine and dandy.
huxaiphaer commentedon Mar 8, 2019
Me too the same error. Hey @viktorlarsson what if reactjs ?
soer7022 commentedon Mar 8, 2019
Got the same error on the latest node image
CaptainJojo commentedon Mar 8, 2019
Same here
Use LTS version of node
Use LTS version of node
someden commentedon Mar 8, 2019
There is no error with node v11.10.1, but it is with v11.11.0
Example v11.10.1:
Example v11.11.0:
DavidODonovan commentedon Mar 8, 2019
same here
This is to resolve a bug with the latest version of Node and Jest see:
dbenchi commentedon Mar 8, 2019
Same here
fix: jest bug (react/create-react-app#6591)
Marjona6 commentedon Mar 8, 2019
Please fix this :(
40 remaining items
downgrade Node.js version in travis build due to issues with jest (se…
Pin node version to v11.10.1
chore(build): upgrade `jest` to fix regression issue introduced
update deps to solve react/create-react-app#6591
ldco2016 commentedon Mar 17, 2019
None of the solutions in this thread have helped me, so yes, please refrain from posting what personally worked for you until a solution exists that works for everybody, this is frustrating.
soer7022 commentedon Mar 17, 2019
How are you supposed to know if it works for everyone or not?
ianschmitz commentedon Mar 17, 2019
We've released an alpha of create-react-app 3.0. Head on over to #6475 for instructions to install the latest alpha build which includes Jest 24. Let us know if it solves this issue!
yurtaev commentedon Mar 18, 2019
@ianschmitz Yes, it solved the problem 👍
yurtaev commentedon Mar 19, 2019
node 11.12 fixed it
nartoland commentedon Mar 19, 2019
Ok
ianschmitz commentedon Mar 19, 2019
Closing as it sounds like this is resolved in Node 11.12
Upgrade jest to allow running tests with node.js 11.11
Remove unused TxDeploy import (#37)