-
-
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
Moving src files doesn't bust the Jest cache #3705
Comments
I have the same problem. I have to run all my tests with |
Also experiencing this issue. Also, as a workaround, it would be nice to have more info on how to flush the cache manually in case this happens ( |
I'm seeing this same problem, and I can't figure out how to clear the cache - only |
Hi @ljharb , I spent a lot of time trying to figure out where the cache files were created, in my configuration (Mac Os X Sierra, react-scripts 1.0.7 for create-react-app 1.3.1) I found the cache files in the Hope this info can be useful to you if you want to clear them out:
In order to locate them on your machine, I'd issue a |
@nerfologist you can |
Thanks, that helps. jest really needs a clear cache command :-/ |
Having this issue as well. I have two files with paths Removing the cache and running |
This explanation by @thymikee worked like a charm! #3705 (comment)
This explanation by @thymikee worked like a charm! #3705 (comment)
This explanation by @thymikee worked like a charm! jestjs#3705 (comment)
Hey guys, Hopefully you won't need a clear cache command anymore after this is released: #4432 |
Ah nice! Closing this task. |
In case cache clearing is needed in the future, as of 21.3.0, there is a new cli option |
Not sure if this is the same ticket, but I had jest watch report that a test file was completely passing,even after editing that specific test file, and even after re-running all tests with I've been moving a few files so not sure if related, but sure is scary to know that the tests I'm running have no guarantee to be accurate! |
Cannot find module '../findCategory' from 'labelClass.js'
> 1 | import {findBestCategory} from '../findCategory' And it worked well before renaming both files. |
Having a similar issue, running jest as it is works fine, however if I want to add a
Nowhere in my project do I have such an import as it was an old one and it was modified to |
Please open new issues, with reproductions, rather than commenting on old closed ones |
Having same problem. My solution was remove coverage folder from project. And restart |
Alternatively you can also use
|
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 report.
What is the current behavior?
Moving a source file doesn't seem to bust the Jest cache. This causes the default coverage reporter to report missing coverage on the moved file in the new location, and report full coverage on the moved file in the old location.
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
.Here is my src dir structure:
Running jest before moving
index.js
:Moving
index.js
:Rerunning Jest after moving
index.js
(and updating theimport
statement in the test):What is the expected behavior?
Jest should detect that I've moved the file. Running Jest with
--no-cache
"fixes" this (coverage is as expected). Rerunning without--no-cache
causes the issue again (cache isn't cleared?). Editing the moved file however fixes the problem.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest config:
Version details:
The text was updated successfully, but these errors were encountered: