-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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-environment node not working in v22 #5119
Comments
have you upgraded the dependency on the env as well?
|
Ah you know what, it's
They haven't upgraded yet. |
Thanks @SimenB |
I don't like that |
Would someone please explain the fix for this? I was not clear after reading through this problem. I setup my app with
When I run First it was TypeError: environment.setup is not a function When I run,
This is my .babelrc
This is my package.json
|
Had the same problem and solved it by downgrading
I just changed the version and ran Before the fix my output for the command
After the fix:
|
If you use create-react-app you can't upgrade jest without them doing it as well |
I update jest-preset-angular@latest (which is version 5.0.0) and this solved the problem for me. |
It is not supported to update Jest manually in a CRA project. If you have both |
Cheers! Learning everyday 🙂 |
No worries! |
I also have this issue on create-react-native-app(CRNA) here is my {
"name": "sportomatic-mobile",
"version": "0.1.0",
"private": true,
"devDependencies": {
"flow-bin": "^0.56.0",
"jest-expo": "23.0.0",
"react-native-scripts": "1.8.1",
"react-test-renderer": "16.0.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"flow": "flow",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^6.2.2",
"expo": "^23.0.4",
"firebase": "^4.8.1",
"jest-cli": "^22.0.5",
"material-ui": "^0.20.0",
"native-base": "^2.3.5",
"react": "16.0.0",
"react-native": "0.50.3",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"reselect": "^3.0.1"
}
} I do not have |
It seems like at least in part the problem is on the Jest side. |
We'll start doing preflight checks in future CRA versions to fail fast with clear instructions when this happens. |
I think the same checks should be done for CRNA as well. |
Sorry, but I meet the same problem. Anyone know how to fix it? |
If you have both |
@gaearon, that didn't fix what I'm running into with a new CRA app (TypeError: environment.setup is not a function) It turns out that |
I think it's a problem with Jest's package.json not resolving jest-cli via npm (re @gaearon 's comment above #5119 (comment)), resolves fine with Yarn.
|
|
- this avoids the following documented error jestjs/jest#5119 - this also removes `node_modules/.bin` which is automatically added to the path
@gaearon You are the real MVP, thanks! I accidentally installed those packages during setup and this saved me. |
If you are trying @gaearon's fix and have jest-cli then delete that as well. |
I faced this issue when I first ran I just removed |
For anyone who might still be seeing this, make sure to update jest globally too -- and update any jest presets or extensions as well |
Jest is included in react-scripts. This was causing a problem because that version was different than the one installed at the top level of package.json. For more details on the issue and solution, see this issue: jestjs/jest#5119 (comment)
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. |
Seeing this error message:
When using this syntax at the top of the test file (worked in v21):
The text was updated successfully, but these errors were encountered: