test: deflake test-watch-mode-restart-esm-loading-error

The previous deflake of this test, #63390, gave the two restart
waits common.platformTimeout(10_000) and left the first restart()
on the helper's 1000 ms default. That first call is the one still
timing out on CI.

It is also the call that needs the budget most. --watch spawns a
child process to run the script, so reaching the first Completed
running costs two process startups, while the later restarts pay for
one. Wrapping the default in platformTimeout() would not have been
enough on its own: none of its multipliers reaches a factor of ten,
so the budget would still be 1000 ms on these jobs, or 2000 ms in a
debug build.

Give that call the budget the other two already ask for, stated once in
the default rather than three times. The timer bounds how long the test
waits for watch mode to make progress, it is not an assertion about
restart latency, and the assertions on stdout and stderr are untouched.

The same helper is duplicated in test-watch-mode.mjs, with the same
default and nine call sites that take it. That file has carried
PASS, FLAKY since #44898, which is why only this one surfaces in the
reliability reports.

Signed-off-by: Christian Aurich <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65623
Refs: https://github.com/nodejs/node/pull/63390
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-08-18.md
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-08-20.md
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-08-21.md
Refs: https://github.com/nodejs/node/issues/44898
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Christian Aurich authored and Antoine du Hamel committed 2026-09-09 23:40:26 +02:00
1 parent 099c20fcbd
commit 500b98cc7d
1 file changed
+3 -3
@@ -74,7 +74,7 @@ function runInBackground({ args = [], options = {}, completed = 'Completed runni
future.resolve();
return { stdout, stderr };
},
restart(timeout = 1000) {
restart(timeout = common.platformTimeout(10_000)) {
if (!child) {
run();
}
@@ -113,7 +113,7 @@ try {
// Update file with syntax error
const syntaxErrorContent = `console.log('hello, wor`;
const failedRestart = restart(common.platformTimeout(10_000));
const failedRestart = restart();
writeFileSync(file, syntaxErrorContent);
await sleep(common.platformTimeout(1000));
// Wait for the failed restart
@@ -125,7 +125,7 @@ try {
`Failed running ${inspect(file)}. Waiting for file changes before restarting...`,
]);
const successfulRestart = restart(common.platformTimeout(10_000));
const successfulRestart = restart();
writeFileSync(file, `console.log('hello again, world');`);
await sleep(common.platformTimeout(1000));
const { stderr: stderr3, stdout: stdout3 } = await successfulRestart;