test: apply a delay to `watch-mode-kill-signal` tests · nodejs/node@0972626 · GitHub
Skip to content

Commit 0972626

Browse files
joyeecheungaduh95
authored andcommitted
test: apply a delay to watch-mode-kill-signal tests
The test is still flaking on macOS. This might be caused by fs event coalescing. Apply a delay to reduce the chance of it. Also, add a bit more logs to show more information. PR-URL: #60610 Refs: https://github.com/nodejs/reliability/blob/main/reports/2025-11-07.md Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent b4f63ee commit 0972626

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

test/fixtures/kill-signal-for-watch.js

Lines changed: 4 additions & 1 deletion

test/parallel/test-watch-mode-kill-signal-default.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ child.on('message', (msg) => {
5151
const match = msg.match(/script ready (\d+)/);
5252
if (match) {
5353
firstGrandchildPid = match[1]; // This is the first grandchild
54-
writeFileSync(indexPath, indexContents);
54+
const writeDelay = 1000; // Delay to reduce the chance of fs events coalescing
55+
console.log(`[PARENT] writing to restart ${firstGrandchildPid} after ${writeDelay}ms`);
56+
setTimeout(() => {
57+
console.log(`[PARENT] writing to ${indexPath} to restart ${firstGrandchildPid}`);
58+
writeFileSync(indexPath, indexContents);
59+
}, writeDelay);
5560
}
5661
}
5762
});

test/parallel/test-watch-mode-kill-signal-override.mjs

Lines changed: 6 additions & 1 deletion

0 commit comments

Comments
 (0)