-
-
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: require(...) is not a function #6046
Comments
The error is basically what #5888 tries to highlight, but due to the asynchronicity at play, it fails at a different place. In your case the runtime stops here: https://github.com/facebook/jest/blob/4f64c4cfa951cc4c437a40650cec8d9b74735af8/packages/jest-runtime/src/index.js#L504-L507 The watchers are triggered asynchronously, and your synchronous code doesn't wait for it. You can use something like https://www.npmjs.com/package/wait-for-expect to wait for the expect to pass, or just add a small timeout yourself |
We should really handle "someone is trying to use the jest-environment after it was torn down" better, though |
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. |
TypeError: require(...) is not a function
What is the current behavior?
I try to create a simple wrapper around chokidar. Also i like to add some smoke tests with jest. I use flow types, and babel6 with flow and env presets.
This is my test code
This is the api:
Very simple, but with jest is can't start. When i start this with jest latest version, i get back this error:
But when i just start with babel build and simple node command, the api working as expected.
Please provide your exact Jest configuration
Not use any, just the .babelrc with env and flow presets.
Run
npx envinfo --preset jest
in your project directory and paste theresults here
npx: installed 1 in 4.267s
System:
OS: macOS High Sierra 10.13.4
CPU: x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Binaries:
Node: 8.11.1 - ~/.nvm/versions/node/v8.11.1/bin/node
Yarn: 1.5.1 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.1/bin/npm
npmPackages:
jest: ^22.4.3 => 22.4.3
The text was updated successfully, but these errors were encountered: