@@ -15,7 +15,9 @@ const parseSection = (text, startMarker, endMarker) => {
1515  const  match  =  text . match ( regExp ) ; 
1616  assert ( match , 
1717         `Unable to locate text between '${ startMarker } ${ endMarker }  ) ; 
18-   return  match [ 1 ] . split ( / \r ? \n / ) ; 
18+   return  match [ 1 ] 
19+          . split ( / \r ? \n / ) 
20+          . filter ( ( val )  =>  val . trim ( )  !==  '' ) ; 
1921} ; 
2022
2123const  nodeOptionsLines  =  parseSection ( cliText , 
@@ -24,28 +26,35 @@ const nodeOptionsLines = parseSection(cliText,
2426const  v8OptionsLines  =  parseSection ( cliText , 
2527                                    '<!-- node-options-v8 start -->' , 
2628                                    '<!-- node-options-v8 end -->' ) ; 
29+ 
2730// Check the options are documented in alphabetical order. 
2831assert . deepStrictEqual ( nodeOptionsLines ,  [ ...nodeOptionsLines ] . sort ( ) ) ; 
2932assert . deepStrictEqual ( v8OptionsLines ,  [ ...v8OptionsLines ] . sort ( ) ) ; 
3033
3134const  documented  =  new  Set ( ) ; 
3235for  ( const  line  of  [ ...nodeOptionsLines ,  ...v8OptionsLines ] )  { 
3336  for  ( const  match  of  line . matchAll ( / ` ( - [ ^ ` ] + ) ` / g) )  { 
34-     const  option  =  match [ 1 ] ; 
37+     // Remove negation from the option's name. 
38+     const  option  =  match [ 1 ] . replace ( '--no-' ,  '--' ) ; 
3539    assert ( ! documented . has ( option ) , 
3640           `Option '${ option }   + 
3741           `allowed option for NODE_OPTIONS in ${ cliMd }  ) ; 
3842    documented . add ( option ) ; 
3943  } 
4044} 
4145
46+ if  ( ! common . hasOpenSSL3 )  { 
47+   documented . delete ( '--openssl-legacy-provider' ) ; 
48+ } 
49+ 
4250// Filter out options that are conditionally present. 
4351const  conditionalOpts  =  [ 
4452  { 
4553    include : common . hasCrypto , 
4654    filter : ( opt )  =>  { 
4755      return  [ 
4856        '--openssl-config' , 
57+         common . hasOpenSSL3  ? '--openssl-legacy-provider'  : '' , 
4958        '--tls-cipher-list' , 
5059        '--use-bundled-ca' , 
5160        '--use-openssl-ca' , 
@@ -86,12 +95,25 @@ const undocumented = difference(process.allowedNodeEnvironmentFlags,
8695                                documented ) ; 
8796// Remove intentionally undocumented options. 
8897assert ( undocumented . delete ( '--debug-arraybuffer-allocations' ) ) ; 
98+ assert ( undocumented . delete ( '--no-debug-arraybuffer-allocations' ) ) ; 
8999assert ( undocumented . delete ( '--es-module-specifier-resolution' ) ) ; 
90100assert ( undocumented . delete ( '--experimental-report' ) ) ; 
91101assert ( undocumented . delete ( '--experimental-worker' ) ) ; 
102+ assert ( undocumented . delete ( '--node-snapshot' ) ) ; 
92103assert ( undocumented . delete ( '--no-node-snapshot' ) ) ; 
93104assert ( undocumented . delete ( '--loader' ) ) ; 
94105assert ( undocumented . delete ( '--verify-base-objects' ) ) ; 
106+ assert ( undocumented . delete ( '--no-verify-base-objects' ) ) ; 
107+ assert ( undocumented . delete ( '--experimental-modules' ) ) ; 
108+ 
109+ 
110+ // Remove negated versions of the flags. 
111+ for  ( const  flag  of  undocumented )  { 
112+   if  ( flag . startsWith ( '--no-' ) )  { 
113+     assert ( documented . has ( `--${ flag . slice ( 5 ) }  ) ,  flag ) ; 
114+     undocumented . delete ( flag ) ; 
115+   } 
116+ } 
95117
96118assert . strictEqual ( undocumented . size ,  0 , 
97119                   'The following options are not documented as allowed in '  + 
0 commit comments