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.

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 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.06%. Comparing base (9f1e44c) to head (e3abb7f).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64457      +/-   ##
==========================================
- Coverage   90.06%   90.06%   -0.01%     
==========================================
  Files         754      754              
  Lines      256360   256360              
  Branches    48480    48481       +1     
==========================================
- Hits       230903   230900       -3     
- Misses      16584    16587       +3     
  Partials     8873     8873              
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 94.94% <100.00%> (ø)

... and 28 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.

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