MCPcopy Create free account
hub / github.com/nodejs/node / workerTest

Function workerTest

test/parallel/test-cli-node-options.js:144–162  ·  view source on GitHub ↗
(opts, command, wantsError, test)

Source from the content-addressed store, hash-verified

142}
143
144function workerTest(opts, command, wantsError, test) {
145 let workerError = null;
146 const worker = new Worker(command, {
147 ...opts,
148 execArgv: [],
149 eval: true,
150 stdout: true,
151 stderr: true
152 });
153 worker.on('error', (err) => {
154 workerError = err;
155 });
156 worker.on('exit', common.mustCall((code) => {
157 assert.strictEqual(code, wantsError ? 1 : 0);
158 collectStream(worker.stdout).then((stdout) => {
159 test(workerError, stdout);
160 }).then(common.mustCall());
161 }));
162}

Callers 1

expectFunction · 0.85

Calls 4

collectStreamFunction · 0.85
testFunction · 0.70
onMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected