mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test: deflake watch mode tests
Use isolated directories for the NODE_OPTIONS watch paths to avoid
recursively watching the repository's source and test trees. Allow a
platform-scaled 10 seconds for startup and restarts.
Remove the flaky markers for test-watch-mode and
test-watch-mode-inspect. The inspector restart race was already fixed
in f2aaf63846.
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/66232
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
8e8c9762a8
commit
aaa7a7aebe
2 files changed
+8
-5
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in new issue
Block a user