Skip to content

Commit

Permalink
test: add hasCrypto check to common flags check
Browse files Browse the repository at this point in the history
Currently, if node is configured --without-ssl there will be a number of
test errors related to crypto flags:

Error: Test has to be started with the flag: '--tls-v1.1'

This commit adds a hasCrypto check to the flags checking similar to what
is done for --without-intl.

PR-URL: #25147
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
danbev authored and MylesBorins committed May 16, 2019
1 parent 173e5fe commit 424f254
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const {

const noop = () => {};

const hasCrypto = Boolean(process.versions.openssl);

const isMainThread = (() => {
try {
return require('worker_threads').isMainThread;
Expand Down Expand Up @@ -74,6 +76,9 @@ 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.config.variables.v8_enable_inspector !== 0 ||
Expand Down Expand Up @@ -106,7 +111,6 @@ const rootDir = isWindows ? 'c:\\' : '/';

const buildType = process.config.target_defaults.default_configuration;

const hasCrypto = Boolean(process.versions.openssl);

// If env var is set then enable async_hook hooks for all tests.
if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
Expand Down

0 comments on commit 424f254

Please sign in to comment.