Skip to content

test: avoid repeated writes in watch helper - #63386

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:flaky-test-run-watch-repeatedly
May 19, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:flaky-test-run-watch-repeatedly

Conversation

@trivikr

@trivikr trivikr commented May 17, 2026 •

Copy link
Copy Markdown
Member

The shared watch helper was repeatedly writing the watched file in the
run({ watch: true }) update path until the second run completed. On slow CI,
that can trigger another watch restart while the previous rerun is still
active. The test runner then terminates the in-flight child process with
SIGTERM, and the captured output can include both a failed file-level subtest
and the next successful run.

This changes the update path to use performFileOperation(), matching the
helper’s rename/create paths. For the run() API path, that schedules a single
delayed write instead of rewriting until the second run completes. The helper
still waits for the next completed run before asserting output.

This also tightens run completion detection to count only root summary
duration_ms lines, instead of any duration_ms field in the TAP output.

Historical context: