Skip to content

Commit 059d30e

Browse files
danbevaddaleax
authored andcommitted
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: #25811 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 7656d58 commit 059d30e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/parallel/test-worker-cleanexit-with-moduleload.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33

44
// Harden the thread interactions on the exit path.
55
// Ensure workers are able to bail out safe at
@@ -9,10 +9,15 @@ require('../common');
99
// preferrably in the C++ land.
1010

1111
const { Worker } = require('worker_threads');
12+
const modules = [ 'fs', 'assert', 'async_hooks', 'buffer', 'child_process',
13+
'net', 'http', 'os', 'path', 'v8', 'vm'
14+
];
15+
if (common.hasCrypto) {
16+
modules.push('https');
17+
}
18+
1219
for (let i = 0; i < 10; i++) {
13-
new Worker("const modules = ['fs', 'assert', 'async_hooks'," +
14-
"'buffer', 'child_process', 'net', 'http', 'https', 'os'," +
15-
"'path', 'v8', 'vm'];" +
20+
new Worker(`const modules = [${modules.map((m) => `'${m}'`)}];` +
1621
'modules.forEach((module) => {' +
1722
'const m = require(module);' +
1823
'});', { eval: true });

0 commit comments

Comments
 (0)