MCPcopy Index your code
hub / github.com/nodejs/node / parent

Function parent

test/parallel/test-worker-exit-code.js:27–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27function parent() {
28 const test = common.mustCall((arg, name = 'worker', exit, error = null) => {
29 const w = new Worker(__filename);
30 w.on('exit', common.mustCall((code) => {
31 assert.strictEqual(
32 code, exit,
33 `wrong exit for ${arg}-${name}\nexpected:${exit} but got:${code}`);
34 console.log(`ok - ${arg} exited with ${exit}`);
35 }));
36 if (error) {
37 w.on('error', common.mustCall((err) => {
38 console.log(err);
39 assert.match(String(err), error);
40 }));
41 }
42 w.postMessage(arg);
43 }, testCases.length);
44
45 testCases.forEach((tc, i) => test(i, tc.func.name, tc.result, tc.error));
46}

Callers 1

Calls 7

postMessageMethod · 0.95
StringClass · 0.85
testFunction · 0.70
matchMethod · 0.65
forEachMethod · 0.65
onMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…