GeezerVison is showing github.com — test: deflake watch mode tests · nodejs/node@43094e2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/sequential/sequential.status -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,9 +7,6 @@ prefix sequential | 7 | 7 | [true] # This section applies to all platforms | 8 | 8 | # https://github.com/nodejs/node/issues/27611#issuecomment-613100468 | 9 | 9 | test-cpu-prof-dir-worker: PASS, FLAKY | 10 | | -# https://github.com/nodejs/node/issues/44898 | 11 | | -test-watch-mode: PASS, FLAKY | 12 | | -test-watch-mode-inspect: PASS, FLAKY | 13 | 10 | # https://github.com/nodejs/node/issues/47409 | 14 | 11 | test-http2-large-file: PASS, FLAKY | 15 | 12 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/sequential/test-watch-mode.mjs +8-2Lines changed: 8 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -87,7 +87,7 @@ function runInBackground({ args = [], options = {}, completed = 'Completed runni | 87 | 87 | future.resolve(); | 88 | 88 | return { stdout, stderr }; | 89 | 89 | }, | 90 | | - restart(timeout = 1000) { | | 90 | + restart(timeout = common.platformTimeout(10_000)) { | 91 | 91 | if (!child) { | 92 | 92 | run(); | 93 | 93 | } | @@ -996,6 +996,10 @@ process.on('message', (message) => { | 996 | 996 | }); | 997 | 997 |
| 998 | 998 | it('should strip all watch flags from NODE_OPTIONS in child process', async () => { | | 999 | + // Avoid recursively watching the repository's source and test trees. | | 1000 | + const cwd = tmpdir.resolve('node-options'); | | 1001 | + mkdirSync(path.join(cwd, 'src'), { recursive: true }); | | 1002 | + mkdirSync(path.join(cwd, 'test')); | 999 | 1003 | const file = createTmpFile('console.log(process.env.NODE_OPTIONS);'); | 1000 | 1004 | const nodeOptions = [ | 1001 | 1005 | '--watch', | @@ -1012,6 +1016,7 @@ process.on('message', (message) => { | 1012 | 1016 | const { done, restart } = runInBackground({ | 1013 | 1017 | args: ['--watch', file], | 1014 | 1018 | options: { | | 1019 | + cwd, | 1015 | 1020 | env: { ...process.env, NODE_OPTIONS: nodeOptions }, | 1016 | 1021 | }, | 1017 | 1022 | }); | @@ -1040,7 +1045,8 @@ process.on('message', (message) => { | 1040 | 1045 | writeFileSync(reqFile, 'globalThis.requiredOk = true;'); | 1041 | 1046 |
| 1042 | 1047 | const file = createTmpFile('console.log("required:" + !!globalThis.requiredOk);'); | 1043 | | - const nodeOptions = `--watch --require "${reqFile}"`; | | 1048 | + // Backslashes inside quoted NODE_OPTIONS values are escape characters. | | 1049 | + const nodeOptions = `--watch --require "${reqFile.replaceAll(path.sep, '/')}"`; | 1044 | 1050 | const { done, restart } = runInBackground({ | 1045 | 1051 | args: ['--watch', file], | 1046 | 1052 | options: { | |
|