feat(browser): trigger test re-runs on source file changes in watch mode#869
feat(browser): trigger test re-runs on source file changes in watch mode#869
Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This pull request implements intelligent test re-runs in browser watch mode by tracking webpack chunk hash changes to detect when source file modifications affect test files. Previously, when a source file like src/a.ts changed, the test file a.test.ts that imported it would not automatically re-run even though it was recompiled. This PR addresses that gap by introducing chunk hash diffing to identify affected test files and selectively re-run only those tests.
Changes:
- Added chunk hash tracking and diffing logic to detect source file changes affecting test files
- Modified watch mode to selectively re-run only affected tests instead of all tests
- Added comprehensive E2E test coverage for source file change detection with multiple dependent test files
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/browser/src/hostController.ts | Implements chunk hash tracking, affected test file detection logic, and integrates it into the watch mode workflow; also converts verbose logging to debug level |
| e2e/browser-mode/watch.test.ts | Adds new E2E test verifying that source file changes trigger re-runs of all dependent test files; updates expected test file count |
| e2e/browser-mode/fixtures/watch/tests/index.test.ts | Adds test case that imports and uses the shared helper module |
| e2e/browser-mode/fixtures/watch/tests/another.test.ts | New test file that also imports and uses the shared helper module |
| e2e/browser-mode/fixtures/watch/src/helper.ts | New shared source file used by multiple test files to verify change detection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5083cb3 to
0dce228
Compare
Summary
human input:
previously, provide given files
a.test.ts -> src/a.ts, changingsrc/a.tswon't trigger a test rerun (although it's recompiled), this PR is to address this by finding test file from changed chunk.Related Links
Checklist