-
-
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
TypeError: Cannot read property 'context' of undefined #7740
Comments
Confirmed. Probably introduced by #7562 |
It happens since we run both setup and teardown even if there's no tests. So it also happens if there are no tests found, and jest is run with |
See #7745. |
Thanks friends 🤗 |
@kentcdodds release is out 8a2ea1e |
Sweet! |
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 you have a
globalSetup
script, this error shows up when trying to start jest with watch mode:To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should start Jest in watch mode.
Link to repl or repo (highly encouraged)
I just reused the same repo from my other issue. It's on the
context-issues
branch here: https://github.com/kentcdodds/jest-transform-self-transform-bug/tree/context-issueHere's the difference for the initiated: https://github.com/kentcdodds/jest-transform-self-transform-bug/compare/context-issue
Run
npx envinfo --preset jest
Paste the results here:
I pulled this up in a debugger and got this:
This code is here: https://github.com/facebook/jest/blob/2e2d2c8dedb76e71c0dfa85ed36b81d1f89e0d87/packages/jest-cli/src/runGlobalHook.js#L41-L48
The
modulePath
variable is the path to the globalSetup file.Note that the tests run fine when not in watch mode.
The text was updated successfully, but these errors were encountered: