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

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

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>
@nodejs-github-botnodejs-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
bitpshrforce-pushed the test-runner/watch-restarted-file branch from 9c65306 to 7871adeCompareJuly 12, 2026 16:31
@bitpshr

Copy link
Copy Markdown
ContributorAuthor

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.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ciPRs that need a full CI run.test_runnerIssues 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

@bitpshr@nodejs-github-bot