-
-
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
Changing a file's access time re-runs tests in watch mode #7124
Comments
Interesting! @rubennorte thoughts on this? I don't know if it's part of the metadata we get here: https://github.com/facebook/jest/blob/19ceeb5b31e5ad483d1425bb8cd9a38aa583740b/packages/jest-cli/src/watch.js#L196-L199. It contains `fs.Stats, but I'm not sure if it's possible for us to knwo that's the only thing that changed. A possible workaround for you is to use https://www.npmjs.com/package/jest-runner-flowtype, not sure if it' feasible or not 🙂 |
I've seen apps deal with this kind of thing by comparing access/modified time stamps when getting the change event.
Thanks! I didn't know about it. I'll try it. |
@SimenB we should be able to know when only the access time changed and do nothing in that case. |
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. |
🐛 Bug Report
When running
jest --watch
, changing a file's access time triggers a test re-run.To Reproduce
Steps to reproduce the behavior:
jest --watch
touch -a src/components/SomeComponent.js
Expected behavior
I don't expect Jest to re-run tests when only the access time changes. I would expect it to re-run tests when the modified time changes or new files are added, etc.
Link to repl or repo (highly encouraged)
Please provide either a repl.it demo or a minimal repository on GitHub.
Issues without a reproduction link are likely to stall.
Run
npx envinfo --preset jest
Paste the results here:
The
chokidar
file watcher always changes access time shortly after a file is modified. I'm not sure why and I'm not sure how to turn it off. Since I usechokidar
in a separate shell to runflow
as I edit code, this causes my tests to always run twice.The text was updated successfully, but these errors were encountered: