Skip to content

feat(browser): trigger test re-runs on source file changes in watch mode#869

Merged
fi3ework merged 1 commit intomainfrom
fix-src-watch
Jan 15, 2026
Merged

feat(browser): trigger test re-runs on source file changes in watch mode#869
fi3ework merged 1 commit intomainfrom
fix-src-watch

Conversation

@fi3ework
Copy link
Copy Markdown
Member

@fi3ework fi3ework commented Jan 15, 2026

Summary

  • Add chunk hash diffing to detect source file changes affecting test files
  • Only re-run affected tests when source files change (not all tests)
  • Track chunk hashes between compilations to identify changed dependencies
  • Support multiple test files depending on same source file

human input:

previously, provide given files a.test.ts -> src/a.ts, changing src/a.ts won'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

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link
Copy Markdown

netlify bot commented Jan 15, 2026

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 0dce228
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/6968a98cce85590008bc6176
😎 Deploy Preview https://deploy-preview-869--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@fi3ework fi3ework marked this pull request as ready for review January 15, 2026 08:09
Copilot AI review requested due to automatic review settings January 15, 2026 08:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fi3ework fi3ework enabled auto-merge (squash) January 15, 2026 09:19
@fi3ework fi3ework merged commit 956edac into main Jan 15, 2026
24 of 25 checks passed
@fi3ework fi3ework deleted the fix-src-watch branch January 15, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants