babel-jest module isn't found if not added directly
See original GitHub issueHi guys, I noticed today that I cannot run tests anymore if I have setup Babel transpilation for JS files.
I get this error
● Validation Error:
Module babel-jest in the transform option was not found.
<rootDir> is: D:\Sources\smile80\libs\renderer
Configuration Documentation:
https://jestjs.io/docs/configuration.html
I checked my yarn.lock
file and babel-jest
is actually present in the file, but there’s no folder into node_modules, that may be the cause.
Lately I upgraded to yarn 1.16.0, so I tried downgrading to 1.15.2, but with no results: same error.
If I add it as a direct dependency, it restarts working.
I’m pretty confused right now, I checked my history and I’m pretty sure that 2 days ago I launched my tests without problems and without babel-jest
as direct dependency.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Issue with babel-jest dependency when running npm start in a ...
First of all, read the error message in the cmd from the beginning. They'll tell you what module is causing the problem. ·...
Read more >Getting Started - Jest
You can run Jest directly from the CLI (if it's globally available in your PATH , e.g. by yarn global add jest or...
Read more >babel/preset-env
@babel/preset-env would not be possible if not for a number of awesome ... @babel/preset-env will add direct references to core-js modules as bare...
Read more >cannot find module 'jest-config' - You.com | The AI Search ...
If the error Cannot find module issue in vue jest testing occures, set the preset property of jest.config.js file as below. module.exports =...
Read more >babel-jest | Yarn - Package Manager
If you are already using jest-cli , add babel-jest and it will automatically compile JavaScript code using Babel. yarn add --dev babel-jest @babel/core....
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
I ran into this when using yarn workspaces. One of my packages was using babel-jest for testing but when I added babel-jest to the package.json it would add to the repo’s root yarn.lock file and not to the node_modules folder of the package. In my jest transform I was referencing babel-jest like this:
To fix, I just removed the relative path:
@inlightmedia Not all heroes wear capes, or perhaps you do, in which case I like you even more. Thank you!