Skip to content
Closed
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
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ test-worker-memory: PASS,FLAKY
[$system==macos]

[$arch==arm || $arch==arm64]
# https://github.com/nodejs/node/issues/25028
test-cli-node-options: PASS,FLAKY

[$system==solaris] # Also applies to SmartOS

Expand Down
32 changes: 20 additions & 12 deletions test/parallel/test-cli-node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ if (process.config.variables.node_without_node_options)
// Test options specified by env variable.

const assert = require('assert');
const exec = require('child_process').execFile;
// Don't change this to execFile(). This test launches too many processes for
// underpowered machines in CI with limited PID space to launch them in parallel
// without causing failures.
const { execFileSync } = require('child_process');

const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
Expand Down Expand Up @@ -56,7 +59,7 @@ if (common.hasCrypto) {
expect('--abort_on-uncaught_exception', 'B\n');
expect('--max-old-space-size=0', 'B\n');
expect('--stack-trace-limit=100',
/(\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/,
/(\s*at f \(\[eval\]:1:\d+\)\r?\n){100}/,
'(function f() { f(); })();',
true);

Expand All @@ -66,18 +69,23 @@ function expect(opt, want, command = 'console.log("B")', wantsError = false) {
cwd: tmpdir.path,
env: Object.assign({}, process.env, { NODE_OPTIONS: opt }),
maxBuffer: 1e6,
stdio: 'pipe',
};

if (typeof want === 'string')
want = new RegExp(want);
exec(process.execPath, argv, opts, common.mustCall((err, stdout, stderr) => {
if (wantsError) {
stdout = stderr;
} else {
assert.ifError(err);
}
if (want.test(stdout)) return;

const o = JSON.stringify(opt);
assert.fail(`For ${o}, failed to find ${want} in: <\n${stdout}\n>`);
}));
let stdout;
try {
stdout = execFileSync(process.execPath, argv, opts);
} catch (e) {
if (!wantsError)
throw e;
stdout = e.output[2].toString();
}

if (want.test(stdout)) return;

const o = JSON.stringify(opt);
assert.fail(`For ${o}, failed to find ${want} in: <\n${stdout}\n>`);
}