-
-
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
setting testEnvironment to node causes jest functions to be undefined #9538
Comments
Jest itself sets it to |
Here's a simple test https://github.com/alyhegazy/jest-tests-bug.git |
Right, that's a bug in node 10.14.0 and 10.14.1 (possibly earlier as well, didn't check) - 10.14.2 (and newer) works correctly. Fix is nodejs/node#23206. (duplicate of #9453) |
Damn, I wasted one whole day :| |
Tell me about it! |
@alyhegazy What you want to know? |
Wasted few hours on this. :( Thanks for the fix. |
I've published 25.2.2 which has a workaround for this issue on the buggy versions of node |
Thanks for this -- had issues using 10.13.0. Seems like jest 26 no longer works with node 10.13, but downgrading to 25.2.2 does. Any way to get 26 to support the buggy versions of node? |
@enuchi Jest 26 requires Node >=10.14.2 |
Precisely because of this issue |
Cool. Thanks! |
This was such a stupid big and I spent nearly 1 hour exploring it. |
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
When setting
testEnvironment
to node and running a test I getReferenceError: test is not defined
. If I removetestEnvironment: 'node'
from the config it runs fine. The same applies todescribe
,beforeAll
...etc.Note: it works fine on node 10.16.0
To Reproduce
Steps to reproduce the behavior:
jest.config.js
test/1.test.js
Expected behavior
Tests should run without errors when testEnvironment is set to node.
Link to repl or repo (highly encouraged)
envinfo
The text was updated successfully, but these errors were encountered: