Skip to content

Commit 6e5ffc4

Browse files
committed
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 <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent f2dc99c commit 6e5ffc4

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)