diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status index 6b5714500b23..4111eb2b8ecf 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -7,9 +7,6 @@ prefix sequential [true] # This section applies to all platforms # https://github.com/nodejs/node/issues/27611#issuecomment-613100468 test-cpu-prof-dir-worker: PASS, FLAKY -# https://github.com/nodejs/node/issues/44898 -test-watch-mode: PASS, FLAKY -test-watch-mode-inspect: PASS, FLAKY # https://github.com/nodejs/node/issues/47409 test-http2-large-file: PASS, FLAKY diff --git a/test/sequential/test-watch-mode.mjs b/test/sequential/test-watch-mode.mjs index d14493192a02..0c28adec0171 100644 --- a/test/sequential/test-watch-mode.mjs +++ b/test/sequential/test-watch-mode.mjs @@ -87,7 +87,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(); } @@ -996,6 +996,10 @@ process.on('message', (message) => { }); it('should strip all watch flags from NODE_OPTIONS in child process', async () => { + // Avoid recursively watching the repository's source and test trees. + const cwd = tmpdir.resolve('node-options'); + mkdirSync(path.join(cwd, 'src'), { recursive: true }); + mkdirSync(path.join(cwd, 'test')); const file = createTmpFile('console.log(process.env.NODE_OPTIONS);'); const nodeOptions = [ '--watch', @@ -1012,6 +1016,7 @@ process.on('message', (message) => { const { done, restart } = runInBackground({ args: ['--watch', file], options: { + cwd, env: { ...process.env, NODE_OPTIONS: nodeOptions }, }, }); @@ -1040,7 +1045,8 @@ process.on('message', (message) => { writeFileSync(reqFile, 'globalThis.requiredOk = true;'); const file = createTmpFile('console.log("required:" + !!globalThis.requiredOk);'); - const nodeOptions = `--watch --require "${reqFile}"`; + // Backslashes inside quoted NODE_OPTIONS values are escape characters. + const nodeOptions = `--watch --require "${reqFile.replaceAll(path.sep, '/')}"`; const { done, restart } = runInBackground({ args: ['--watch', file], options: {