Skip to content

test_runner: report changed file on watch restart - #64457

Open
bitpshr wants to merge 1 commit into
nodejs:mainfrom
bitpshr:test-runner/watch-restarted-file
Open

test_runner: report changed file on watch restart#64457
bitpshr wants to merge 1 commit into
nodejs:mainfrom
bitpshr:test-runner/watch-restarted-file

Conversation

@bitpshr

@bitpshr bitpshr commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

This picks up #63786 and adds a file property to the test:watch:restarted reporter event, so custom reporters can show which file triggered the restart.

The watcher already carries that path on its changed event since #63781, so this mostly just forwards it along. I typed it as {string|undefined} to match test:summary's file, and it's undefined when the triggering file can't be determined. Since the event had no data before, this stays backward-compatible.

I kept the change to the event data so the default spec reporter output is unchanged, but I'm happy to surface the file there too if that seems useful.

Fixes: #63786

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jul 12, 2026
@bitpshr
bitpshr force-pushed the test-runner/watch-restarted-file branch from 9c65306 to 7871ade Compare July 12, 2026 16:31
@bitpshr

bitpshr commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Hi @atlowChemi @ShogunPanda, wanted to keep this on your radar. Small follow-up to #63781: it forwards the changed file into the test:watch:restarted reporter event so custom reporters can show what triggered the restart. Docs and a test included. Whenever you have a moment.

@bitpshr
bitpshr force-pushed the test-runner/watch-restarted-file branch from 7871ade to e3abb7f Compare August 31, 2026 14:01
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.05%. Comparing base (f9ab994) to head (4e244fe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64457      +/-   ##
==========================================
- Coverage   90.07%   90.05%   -0.02%     
==========================================
  Files         754      754              
  Lines      256395   256395              
  Branches    48494    48496       +2     
==========================================
- Hits       230947   230898      -49     
- Misses      16563    16624      +61     
+ Partials     8885     8873      -12     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 94.94% <100.00%> (ø)

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The `test:watch:restarted` reporter event now includes a `file` property
with the path of the file whose change triggered the restart. The
watcher already surfaces this path through the `changed` event since it
started printing the changed file name, so this just forwards it to
consumers of the reporter stream.

Fixes: nodejs#63786
Signed-off-by: Paul Bouchon <mail@bitpshr.net>
@bitpshr
bitpshr force-pushed the test-runner/watch-restarted-file branch from e3abb7f to 4e244fe Compare September 1, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--test --watch should report the file that triggered the restart

2 participants