Skip to content

Commit 5ca01e7

Browse files
committed
fixup
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
1 parent 80dc3b1 commit 5ca01e7

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎test/parallel/test-cli-no-jitless.js‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const wasm = `
1515

1616
for (const flag of [
1717
'--jitless', '--lite-mode', '--lite_mode', '-jitless', '-lite_mode',
18-
'--jitless=true', '--lite_mode=true', '--no-jitless', '--no-lite-mode',
18+
'--no-jitless', '--no-lite-mode',
1919
]) {
2020
const result = spawnSync(process.execPath, [flag, '-e', wasm], { encoding: 'utf8' });
2121
assert.strictEqual(result.status, 0, result.stderr);
@@ -32,6 +32,25 @@ for (const flag of [
3232
assert.strictEqual(runtime.stderr, '');
3333
}
3434

35+
// V8 boolean flags reject explicit values, even for overridden modes.
36+
for (const flag of ['--jitless=true', '--lite_mode=true']) {
37+
const result = spawnSync(process.execPath, [flag, '-e', wasm], { encoding: 'utf8' });
38+
assert.strictEqual(result.status, 9, result.stderr);
39+
assert.strictEqual(result.signal, null);
40+
assert.match(result.stderr, /illegal value for flag .* of type bool/);
41+
42+
// The runtime API reports invalid syntax without throwing, and Node must
43+
// still override any flags V8 changed before reporting the error.
44+
const runtime = spawnSync(process.execPath, ['-e', `
45+
require('v8').setFlagsFromString(${JSON.stringify(flag)});
46+
${wasm}
47+
new (require('worker_threads').Worker)(${JSON.stringify(wasm)}, { eval: true });
48+
`], { encoding: 'utf8' });
49+
assert.strictEqual(runtime.status, 0, runtime.stderr);
50+
assert.strictEqual(runtime.signal, null);
51+
assert.match(runtime.stderr, /illegal value for flag .* of type bool/);
52+
}
53+
3554
// Node's overrides must not be treated as contradictory user-supplied flags.
3655
for (const flag of ['--jitless', '--lite-mode']) {
3756
const result = spawnSync(process.execPath, [

0 commit comments

Comments
 (0)