@@ -15,7 +15,7 @@ const wasm = `
1515
1616for ( 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 , / i l l e g a l v a l u e f o r f l a g .* o f t y p e b o o l / ) ;
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 , / i l l e g a l v a l u e f o r f l a g .* o f t y p e b o o l / ) ;
52+ }
53+
3554// Node's overrides must not be treated as contradictory user-supplied flags.
3655for ( const flag of [ '--jitless' , '--lite-mode' ] ) {
3756 const result = spawnSync ( process . execPath , [
0 commit comments