Skip to content

Commit edad9af

Browse files
BridgeARBethGriggs
authored andcommittedApr 8, 2019
test: move hasCrypto check
The hasCrypto check should be checked before anything else to prevent overhead in case it's not falsy. Otherwise the file would be read without any further benefit. PR-URL: #26858 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
1 parent 2ef1bd9 commit edad9af

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎test/common/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ const hasCrypto = Boolean(process.versions.openssl);
4848

4949
// Check for flags. Skip this for workers (both, the `cluster` module and
5050
// `worker_threads`) and child processes.
51+
// If the binary was built without-ssl then the crypto flags are
52+
// invalid (bad option). The test itself should handle this case.
5153
if (process.argv.length === 2 &&
5254
isMainThread &&
55+
hasCrypto &&
5356
module.parent &&
5457
require('cluster').isMaster) {
5558
// The copyright notice is relatively big and the flags could come afterwards.
@@ -74,9 +77,6 @@ if (process.argv.length === 2 &&
7477
const args = process.execArgv.map((arg) => arg.replace(/_/g, '-'));
7578
for (const flag of flags) {
7679
if (!args.includes(flag) &&
77-
// If the binary was built without-ssl then the crypto flags are
78-
// invalid (bad option). The test itself should handle this case.
79-
hasCrypto &&
8080
// If the binary is build without `intl` the inspect option is
8181
// invalid. The test itself should handle this case.
8282
(process.features.inspector || !flag.startsWith('--inspect'))) {

0 commit comments

Comments
 (0)
Please sign in to comment.