Skip to content
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

[heft-jest] In watch mode, changedFiles should only remove files that match before/after the run #4599

Open
dmichon-msft opened this issue Mar 22, 2024 · 1 comment
Milestone

Comments

@dmichon-msft
Copy link
Contributor

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:

// 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
@dmichon-msft dmichon-msft added this to the Heft 1.0 milestone Mar 22, 2024
@iclanton
Copy link
Member

I've noticed something similar with TypeScript, where errors at some point stop getting reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: High priority
Development

No branches or pull requests

2 participants