Skip to content

Commit

Permalink
test: add hasCrypto to worker-cleanexit-with-moduleload
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
danbev authored and addaleax committed Feb 6, 2019
1 parent 7656d58 commit 059d30e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/parallel/test-worker-cleanexit-with-moduleload.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 });
Expand Down

0 comments on commit 059d30e

Please sign in to comment.