-
-
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
jest --watch fails to determine files to run tests against if there are changes since last commit #6025
Comments
I've never encountered this... Are you able to set up a reproduction for it? |
basically, how can I show a reproduction of that? Any git project using this config and jest --watch has the problem to me. |
I'm having the same issue. It is interesting
I need it. |
I also need moduleNameMapper. @SimenB Here is a recording of the problem: For your information:
So it's certainly a git change detection problem within jest. As you can see VSCode detects the change in control versioning panel, also is my command line (master switching to red). |
I'm unable to reproduce, so if you can put together a minimal repo showing the error (if only just on your amchine), that'd be great! |
@SimenB, I have added tracing to The problem was related to
|
Great that you were able to find a fix! Are you able to set up a reproduction though, so we at least can fix the swallowed error? |
To fix swallowed error I would suggest to throw error inside |
I agree, but we don't swallow it on purpose. A reproduction would help us narrow down where the error is and fix it |
Having a similar issue that might be related: I've deleted the entire |
Had similar issue. Added try-catch (as @eugene-sea suggested) and found few files referenced to non-existing dependencies, e.g.
I tried to add these files into |
I think this was fixed in #6407 available in |
I am use 23.4.2 and it's not fixed. |
Did you try |
My previous report about fixing it is wrong. I thought i was fixed, but then I can do --watch one more time, the same problem happened. Then I did --clearCache, but it didn't fix the problem. when I did --noCache, I get:
Still looking for a solution... |
Oh. Should have read each comment here carefully. The issue is with the coverage folder. Apparently the coverage was referring to some old code that was deleted, and jest is still trying to find it. Deleting the coverage folder fixes the issue for me. |
@dereklin this was exactly it, thanks for posting the fix. |
It would be really great if the error showed where was the wrong file found. I had no idea my old coverage folder was the problem. |
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?
We have an angular project using jest. Jest uses git to determine file changes and run tests against these files.
Clean project
If the project is "clean" with no change since last commit, then running
jest --watch
starts properly. Then we can use it normally, it detects changes properly and run expected tests suits.Dirty project
if the projects has changes on certain files since last commit and we try to run
jest --watch
then Jest struggles to start and stay forever on theDetermining test suites to run...
state. Any change after that doesn't change the stuck jest state.If we revert our changes (nothing to be commited) then retry to launch
jest --watch
works. So it seems it's a real problem with git changes detection by Jest.Environment
This behavior is always encountered on windows. And sometimes on mac OS.
What is the expected behavior?
Being able to run
jest --watch
even if there are modified files since last commit. If the changes files are not detected properly we expect to be able to even load jest and being able to pattern filter on the files we want.Please provide your exact Jest configuration
Run
npx envinfo --preset jest
in your project directory and paste theresults here
The text was updated successfully, but these errors were encountered: