Skip to content

Commit 02885da

Browse files
addaleaxZYSzys
authored andcommitted
test: add ability to skip common flag checks
Currently, `common/index.js` checks that our test files are spawned with the flags specified in `// Flags:`, and re-spawns with them if they are not found. This can be *very* annoying, for example when debugging using debuggers that attach to the parent process, or when intentionally testing with flags that are different from the specified ones. This adds a `NODE_SKIP_FLAG_CHECK` environment variable check. Setting it to a non-empty value will skip the flag checks altogether. PR-URL: #27254 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
1 parent ed89311 commit 02885da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/common/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const hasCrypto = Boolean(process.versions.openssl);
5151
// If the binary was built without-ssl then the crypto flags are
5252
// invalid (bad option). The test itself should handle this case.
5353
if (process.argv.length === 2 &&
54+
!process.env.NODE_SKIP_FLAG_CHECK &&
5455
isMainThread &&
5556
hasCrypto &&
5657
module.parent &&
@@ -82,7 +83,8 @@ if (process.argv.length === 2 &&
8283
(process.features.inspector || !flag.startsWith('--inspect'))) {
8384
console.log(
8485
'NOTE: The test started as a child_process using these flags:',
85-
util.inspect(flags)
86+
util.inspect(flags),
87+
'Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.'
8688
);
8789
const args = [...flags, ...process.execArgv, ...process.argv.slice(1)];
8890
const options = { encoding: 'utf8', stdio: 'inherit' };

0 commit comments

Comments
 (0)