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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Joyee Cheung 2025-11-10 12:11:05 +01:00 committed by GitHub
parent 8a76958005
commit bd3a202133
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 3 deletions

View File

@ -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);

View File

@ -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);
}
}
});

View File

@ -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);
}
}
});