`You are trying to `import` a file after the Jest environment has been torn down.` from inside of babel
See original GitHub issue🐛 Bug Report
Well, this is really strange, since our tests just started randomly failing, both on CI and also locally, not yet sure what is going on, but I get these really strange errors:
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
at _resolve (node_modules/@babel/core/lib/config/files/plugins.js:22:39)
at resolveStandardizedName (node_modules/@babel/core/lib/config/files/plugins.js:101:12)
at resolvePlugin (node_modules/@babel/core/lib/config/files/plugins.js:54:10)
at loadPlugin (node_modules/@babel/core/lib/config/files/plugins.js:62:20)
at createDescriptor (node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at items.map (node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
FAIL react-components packages/react-components/src/primitives/StoreBadge/StoreBadge.test.tsx
● Test suite failed to run
TypeError: _resolve(...).default.sync is not a function
at resolveStandardizedName (node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePlugin (node_modules/@babel/core/lib/config/files/plugins.js:54:10)
at loadPlugin (node_modules/@babel/core/lib/config/files/plugins.js:62:20)
at createDescriptor (node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at items.map (node_modules/@babel/core/lib/config/config-descriptors.js:109:50)
at Array.map (<anonymous>)
at createDescriptors (node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPluginDescriptors (node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
at alias (node_modules/@babel/core/lib/config/config-descriptors.js:63:49)
at cachedFunction (node_modules/@babel/core/lib/config/caching.js:33:19)
To Reproduce
not sure, tests started to fail quite randomly, without a related change…
Expected behavior
tests should succeed
Link to repl or repo (highly encouraged)
sorry, not possible
Run npx envinfo --preset jest
Paste the results here:
System:
OS: Linux 4.20 Arch Linux undefined
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.13.0 - ~/…/node_modules/.bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
npmPackages:
jest: ^24.0.0 => 24.1.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
You are trying to `import` a file after the Jest environment has ...
Torn down means: Jest already finished running and some part of your code is trying to execute after jest has already finished running...
Read more >You are trying to `import` a file after the Jest environment has ...
ReferenceError: You are trying to import a file after the Jest environment has been torn down. at Object.get BackHandler [as BackHandler] ( ...
Read more >You are trying to `import` a file after the Jest environment has ...
Torn down means: Jest already finished running and some part of your code is trying to execute after jest torn down or exited...
Read more >Throwing 'You are importing a file after the Jest environment ...
Hello Internet, I am taking Mosh's node.js course and now learning automated testing. While doing so, an error came at random.
Read more >Configuring Jest
Indicates whether the coverage information should be collected while executing the test. Because this retrofits all executed files with coverage collection ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sounds reasonable 🙂 Too bad the stack traces aren’t too useful…
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. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.