diff --git a/test/fixtures/kill-signal-for-watch.js b/test/fixtures/kill-signal-for-watch.js index 2beeba099b45ff..fe1e91fb5c3971 100644 --- a/test/fixtures/kill-signal-for-watch.js +++ b/test/fixtures/kill-signal-for-watch.js @@ -7,4 +7,7 @@ process.on('SIGINT', () => { process.exit(); }); process.send(`script ready ${process.pid}`); -setTimeout(() => {}, 100_000); +const timeout = 100_000; +setTimeout(() => { + process._rawDebug(`[CHILD] Timeout ${timeout} fired`); +}, timeout); diff --git a/test/parallel/test-watch-mode-kill-signal-default.mjs b/test/parallel/test-watch-mode-kill-signal-default.mjs index 4d6e7bcef8c795..53aec43d22e050 100644 --- a/test/parallel/test-watch-mode-kill-signal-default.mjs +++ b/test/parallel/test-watch-mode-kill-signal-default.mjs @@ -51,7 +51,12 @@ child.on('message', (msg) => { const match = msg.match(/script ready (\d+)/); if (match) { firstGrandchildPid = match[1]; // This is the first grandchild - writeFileSync(indexPath, indexContents); + const writeDelay = 1000; // Delay to reduce the chance of fs events coalescing + console.log(`[PARENT] writing to restart ${firstGrandchildPid} after ${writeDelay}ms`); + setTimeout(() => { + console.log(`[PARENT] writing to ${indexPath} to restart ${firstGrandchildPid}`); + writeFileSync(indexPath, indexContents); + }, writeDelay); } } }); diff --git a/test/parallel/test-watch-mode-kill-signal-override.mjs b/test/parallel/test-watch-mode-kill-signal-override.mjs index 37f6b7e20ffc7c..dc3af3f76e848d 100644 --- a/test/parallel/test-watch-mode-kill-signal-override.mjs +++ b/test/parallel/test-watch-mode-kill-signal-override.mjs @@ -52,7 +52,12 @@ child.on('message', (msg) => { const match = msg.match(/script ready (\d+)/); if (match) { firstGrandchildPid = match[1]; // This is the first grandchild - writeFileSync(indexPath, indexContents); + const writeDelay = 1000; // Delay to reduce the chance of fs events coalescing + console.log(`[PARENT] writing to restart ${firstGrandchildPid} after ${writeDelay}ms`); + setTimeout(() => { + console.log(`[PARENT] writing to ${indexPath} to restart ${firstGrandchildPid}`); + writeFileSync(indexPath, indexContents); + }, writeDelay); } } });