-
-
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
Bug: Cannot find module './createSpy' from 'jasmine-light.js' #4025
Comments
Please provide repro, so someone with Windows setup can triage this. |
...I was just trying simple install as docs describes, but I moved to avajs as it was painless to install and run. I'm sorry for disturbing you. Maybe it was problem only of my setup; if you want, you can close the issue or I can try to find, how I had the previous setup and repo state. |
Sad to hear it didn't work out. We would definitely use some help on making Windows support better. |
I have this error as well, on macOS X. |
I'm also using TypeScript environemnt. |
I am experiencing the same issue. |
I found the issue. I removed |
I suffered the same problem on Linux machine. @Prior99 suggestion solved my problem. |
I've also ran into it and @Prior99 solution fixed it. Fixing it or a better error message would be awesome! |
@vjeux usually removing jest from node_modules (or all node_modules) and installing new version again helps on case insensitive (macOS here) machines. |
@thymikee the problem is that |
This needs a fix then, thanks |
Is there a temporary fix for this? I'm having issues with it and removing node_modules and reinstalling doesn't seem to fix it for me, neither adding the "js" file extension. It only happens to me when I use a custom resolver EDIT: |
Hello, these solutions i couldnt apply... i still have the error Cannot find module './create_spy' from 'jasmine_light.js' #5629 |
i have changed the configuration jest to "jest": { FAIL tests/state-functions.spec.js Your test suite must contain at least one test. at node_modules/jest-cli/build/test_scheduler.js:108:22 |
I wonder if we should check for And in addition just be explicit with Jest's own files which are required inside the sandbox. @thymikee @rickhanlonii thoughts on that? |
Would be best for |
Sure, but as long as jasmine, or circus, is injected into the sandbox, it's hard for user code and config not to. It's why we do the whole fun with Promises.
Would it be slow? I thought maybe we'd have the files in hastefs already, maybe not. And it's already at a point where you're getting an error, spending some IO to try to give a more helpful error in that case seems reasonable to me. It wouldn't run in the happy case. The thing is that ESM requires the extension, IIRC, while node does not, so I'm not sure about warning about "hey, you're missing |
Oh yea, it makes sense to show it when throwing error 👍 |
Whenever someone gets to this, we should also check if there is file casing inconsistency to throw better errors on case sensitive systems then might work locally |
I am not sure if this is related. I got this error (although randomly) when running jest on WSL (Window Subsystem for Linux). But running it on Ubuntu works fine. @SimenB could this be related ? |
Not if you're getting in randomly, no - this issue is for an error in configuration (or typo in |
<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. --> <!-- Please remember to update CHANGELOG.md in the root of the project if you have not done so. --> ## Summary Inspired by #7158, I finally decided to throw a better error in the cases where people have custom `moduleFileExtension` resulting in more or less obscure errors. I've tackled 2 different issues here (in separate commits, happy to split them up into separate PRs if you want). 1. If you require a file without the file extension, we try to look for files matching _with_ a file extension and list them out. Also tell the user to either include file extension in the `require` or update `moduleFileExtension`. 2. If `js` is missing from `moduleFileExtension`, jest is unable to inject into the runtime. I decided to throw an explicit configuration error rather than fixing `jest-jasmine`'s `require`, as we'd also need all of our dependencies to do the same (e.g. `source-map` throws if we do `moduleFileExtension: []` now). Fixes #4025. <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> ## Test plan Integration tests added <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->
Hah, forgot this... If anyone wants to send a PR for this, feel free! |
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. |
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
Cannot find module './createSpy' from 'jasmine-light.js'
npm test
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.What is the expected behavior?
Tests run without en error.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
jest --showConfig:
The text was updated successfully, but these errors were encountered: