From 059d30e369acb1d32ec1b93606a105c5d8f80322 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 30 Jan 2019 10:19:24 +0100 Subject: [PATCH] test: add hasCrypto to worker-cleanexit-with-moduleload Currently, this test fails when configured --without-ssl: === release test-worker-cleanexit-with-moduleload === Path: parallel/test-worker-cleanexit-with-moduleload events.js:173 throw er; // Unhandled 'error' event ^ internal/util.js:101 throw new ERR_NO_CRYPTO(); ^ Error [ERR_NO_CRYPTO]: Node.js is not compiled with OpenSSL crypto support This commit as a check for crypto so that this test is skipped if there is no crypto support. PR-URL: https://github.com/nodejs/node/pull/25811 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- .../test-worker-cleanexit-with-moduleload.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-worker-cleanexit-with-moduleload.js b/test/parallel/test-worker-cleanexit-with-moduleload.js index 172544f50aba79..d4316cfe237157 100644 --- a/test/parallel/test-worker-cleanexit-with-moduleload.js +++ b/test/parallel/test-worker-cleanexit-with-moduleload.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); // Harden the thread interactions on the exit path. // Ensure workers are able to bail out safe at @@ -9,10 +9,15 @@ require('../common'); // preferrably in the C++ land. const { Worker } = require('worker_threads'); +const modules = [ 'fs', 'assert', 'async_hooks', 'buffer', 'child_process', + 'net', 'http', 'os', 'path', 'v8', 'vm' +]; +if (common.hasCrypto) { + modules.push('https'); +} + for (let i = 0; i < 10; i++) { - new Worker("const modules = ['fs', 'assert', 'async_hooks'," + - "'buffer', 'child_process', 'net', 'http', 'https', 'os'," + - "'path', 'v8', 'vm'];" + + new Worker(`const modules = [${modules.map((m) => `'${m}'`)}];` + 'modules.forEach((module) => {' + 'const m = require(module);' + '});', { eval: true });