Skip to content

watch: print name of changed file that triggers restart#63781

Open
marcopiraccini wants to merge 1 commit into
nodejs:mainfrom
marcopiraccini:watch-print-changed-file
Open

watch: print name of changed file that triggers restart#63781
marcopiraccini wants to merge 1 commit into
nodejs:mainfrom
marcopiraccini:watch-print-changed-file

Conversation

@marcopiraccini
Copy link
Copy Markdown
Contributor

watch: print name of changed file that triggers restart

When running with --watch, Node now prints which file changed before the restart message, so users can tell which save actually triggered the rebuild.

Now:

Change detected in 'data/preliminary.csv'
Restarting 'src/app.js'

Implementation

  • FilesWatcher#onChange records the triggering path and includes it on the debounced changed event as trigger.
  • watch_mode.js prints Change detected in <path> between the screen-clear and the existing Restarting line, so it stays visible and keeps the existing output ordering intact.

Tests in test-watch-mode*.mjs are updated to assert the new line.

Fixes: #63767

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 7, 2026
@marcopiraccini marcopiraccini marked this pull request as ready for review June 7, 2026 06:16
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
@marcopiraccini marcopiraccini force-pushed the watch-print-changed-file branch from 406e322 to 053ef2e Compare June 7, 2026 06:18
Copy link
Copy Markdown
Member

@mertcanaltin mertcanaltin left a comment

Choose a reason for hiding this comment

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

LGTM

@atlowChemi atlowChemi changed the title feat: print name of changed file that triggers restart watch: print name of changed file that triggers restart Jun 8, 2026
let child = start();
const restartChild = async () => {
child = await restart(child);
const restartChild = async ({ trigger } = {}) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
const restartChild = async ({ trigger } = {}) => {
const restartChild = async ({ trigger } = kEmptyObject) => {

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--watch should print name of changed file that triggers restart

6 participants