Skip to content

Commit

Permalink
test: move hasCrypto check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
BridgeAR authored and BethGriggs committed Apr 8, 2019
1 parent 2ef1bd9 commit edad9af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ const hasCrypto = Boolean(process.versions.openssl);

// Check for flags. Skip this for workers (both, the `cluster` module and
// `worker_threads`) and child processes.
// 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 &&
isMainThread &&
hasCrypto &&
module.parent &&
require('cluster').isMaster) {
// The copyright notice is relatively big and the flags could come afterwards.
Expand All @@ -74,9 +77,6 @@ if (process.argv.length === 2 &&
const args = process.execArgv.map((arg) => arg.replace(/_/g, '-'));
for (const flag of flags) {
if (!args.includes(flag) &&
// If the binary was built without-ssl then the crypto flags are
// invalid (bad option). The test itself should handle this case.
hasCrypto &&
// If the binary is build without `intl` the inspect option is
// invalid. The test itself should handle this case.
(process.features.inspector || !flag.startsWith('--inspect'))) {
Expand Down

0 comments on commit edad9af

Please sign in to comment.