Skip to content

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

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
marcopiraccini:watch-print-changed-file
Jun 22, 2026
Merged

nodejs-github-bot merged 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.