- Notifications
You must be signed in to change notification settings - Fork 659
Description
Summary
In watch mode, changed file state is cleared more aggressively than it should be, so sometimes changes don't trigger test runs.
Repro steps
Run heft test-watch in a project with a long-running test.
Change a file.
While the test is running, change it again.
Observe that the latter change doesn't trigger a new run.
Details
After a successful run, heft-jest-plugin currently clears the list of changed files:
rushstack/heft-plugins/heft-jest-plugin/src/JestPlugin.ts
Lines 525 to 528 in 8fe0ea8
| // If we ran tests and they succeeded, consider the files to no longer be changed. | |
| // This might be overly-permissive, but there isn't a great way to identify if the changes | |
| // are no longer relevant, unfortunately. | |
| this._changedFiles.clear(); |
It should instead snapshot the current change state prior to the run, then remove files for which the current tracked version matches the version the run "used" (quoted because the plugin doesn't quite have access to the actual runtime version of the file, but a timestamp can be applied when the change notification fires).
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@rushstack/heft-jest-plugin version? | 0.11.23 |
| Operating system? | Linux |
| Would you consider contributing a PR? | Yes |
Node.js version (node -v)? | v18.19.1 |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status