Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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