mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
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: https://github.com/nodejs/node/pull/27254 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
1 parent
ed893111b9
commit
02885dad5a
1 file changed
+3
-1
@@ -51,6 +51,7 @@ const hasCrypto = Boolean(process.versions.openssl);
|
||||
// If the binary was built without-ssl then the crypto flags are
|
||||
// invalid (bad option). The test itself should handle this case.
|
||||
if (process.argv.length === 2 &&
|
||||
!process.env.NODE_SKIP_FLAG_CHECK &&
|
||||
isMainThread &&
|
||||
hasCrypto &&
|
||||
module.parent &&
|
||||
@@ -82,7 +83,8 @@ if (process.argv.length === 2 &&
|
||||
(process.features.inspector || !flag.startsWith('--inspect'))) {
|
||||
console.log(
|
||||
'NOTE: The test started as a child_process using these flags:',
|
||||
util.inspect(flags)
|
||||
util.inspect(flags),
|
||||
'Use NODE_SKIP_FLAG_CHECK to run the test with the original flags.'
|
||||
);
|
||||
const args = [...flags, ...process.execArgv, ...process.argv.slice(1)];
|
||||
const options = { encoding: 'utf8', stdio: 'inherit' };
|
||||
|
||||
Reference in new issue
Block a user