Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions test/sequential/sequential.status
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions test/sequential/test-watch-mode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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',
Expand All @@ -1012,6 +1016,7 @@ process.on('message', (message) => {
const { done, restart } = runInBackground({
args: ['--watch', file],
options: {
cwd,
env: { ...process.env, NODE_OPTIONS: nodeOptions },
},
});
Expand Down Expand Up @@ -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: {
Expand Down
Loading