From d02a66e992f864ded826a8a0f759dacc4470caaf Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 30 Jan 2019 10:19:24 +0100 Subject: [PATCH 1/3] 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. --- test/parallel/test-worker-cleanexit-with-moduleload.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-worker-cleanexit-with-moduleload.js b/test/parallel/test-worker-cleanexit-with-moduleload.js index 172544f50aba79..8532f619db1023 100644 --- a/test/parallel/test-worker-cleanexit-with-moduleload.js +++ b/test/parallel/test-worker-cleanexit-with-moduleload.js @@ -1,5 +1,7 @@ 'use strict'; -require('../common'); +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); // Harden the thread interactions on the exit path. // Ensure workers are able to bail out safe at From 2f5fac199d1d579a77fc0f997dd53f7bbc37ed68 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 31 Jan 2019 07:42:15 +0100 Subject: [PATCH 2/3] squash!: conditionally add https to list of modules --- .../test-worker-cleanexit-with-moduleload.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-worker-cleanexit-with-moduleload.js b/test/parallel/test-worker-cleanexit-with-moduleload.js index 8532f619db1023..93dc49cc66d6bd 100644 --- a/test/parallel/test-worker-cleanexit-with-moduleload.js +++ b/test/parallel/test-worker-cleanexit-with-moduleload.js @@ -1,7 +1,5 @@ 'use strict'; const common = require('../common'); -if (!common.hasCrypto) - common.skip('missing crypto'); // Harden the thread interactions on the exit path. // Ensure workers are able to bail out safe at @@ -11,10 +9,15 @@ if (!common.hasCrypto) // 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 }); From 722bf77eb0259d074cacbab5d04693cc6dd538fe Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 31 Jan 2019 08:18:51 +0100 Subject: [PATCH 3/3] squash!: fix linter issues --- test/parallel/test-worker-cleanexit-with-moduleload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-worker-cleanexit-with-moduleload.js b/test/parallel/test-worker-cleanexit-with-moduleload.js index 93dc49cc66d6bd..d4316cfe237157 100644 --- a/test/parallel/test-worker-cleanexit-with-moduleload.js +++ b/test/parallel/test-worker-cleanexit-with-moduleload.js @@ -10,14 +10,14 @@ const common = require('../common'); const { Worker } = require('worker_threads'); const modules = [ 'fs', 'assert', 'async_hooks', 'buffer', 'child_process', - 'net', 'http', 'os', 'path', 'v8', 'vm' + 'net', 'http', 'os', 'path', 'v8', 'vm' ]; if (common.hasCrypto) { modules.push('https'); } for (let i = 0; i < 10; i++) { - new Worker(`const modules = [${modules.map(m => `'${m}'`)}];` + + new Worker(`const modules = [${modules.map((m) => `'${m}'`)}];` + 'modules.forEach((module) => {' + 'const m = require(module);' + '});', { eval: true });