-
Notifications
You must be signed in to change notification settings - Fork 312
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
babel-jest module isn't found if not added directly #273
Comments
The reason might be that some/several other packages had If this is not the case, each package might have its inner As npm heavily relies on semantic versioning, even running npm on the same day can/will result in different packages (if some package somewhere in the dependency tree changed just a minor version) and deduped packages might not be in the root anymore, as they were yesterday. A general rule of thumb is: if a package is imported/required directly by your project, it should be declared in |
Make sense, even if it should be a rare occurring: all my dependencies are version-locked. That said, maybe it should be added, in the section I linky l linked, that you have to install babel-jest as direct dev-dependency |
If babel is used in any way, babel-jest is required by Jest to be in your dev dependencies. It's in the docs on Babel integration. Feel free to add a note |
Just to avoid confusion, version-locking in npm can only be achieved by installing packages only using Anyway, I will close this issue for now, feel free to reopen in case you feel this is unresolved. |
I use yarn, I think that behaviour is the default. I'll PR a note on the readme as soon as I have some time to add the note |
Oh yeah, yarn is locked to |
I guess you meant the first line of this page. |
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! |
Hi guys, I noticed today that I cannot run tests anymore if I have setup Babel transpilation for JS files.
I get this error
I checked my
yarn.lock
file andbabel-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.The text was updated successfully, but these errors were encountered: