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

Function parent

test/parallel/test-process-exit-code.js:42–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42function parent() {
43 const { spawn } = require('child_process');
44 const node = process.execPath;
45 const f = __filename;
46 const option = { stdio: [ 0, 1, 'ignore' ] };
47
48 const test = common.mustCallAtLeast((arg, name = 'child', exit) => {
49 spawn(node, [f, arg], option).on('exit', common.mustCall((code) => {
50 assert.strictEqual(
51 code, exit,
52 `wrong exit for ${arg}-${name}\nexpected:${exit} but got:${code}`);
53 debug(`ok - ${arg} exited with ${exit}`);
54 }));
55 });
56
57 testCases.forEach((tc, i) => test(i, tc.func.name, tc.result));
58}

Callers 1

Calls 6

spawnFunction · 0.70
testFunction · 0.70
forEachMethod · 0.65
requireFunction · 0.50
debugFunction · 0.50
onMethod · 0.45

Tested by

no test coverage detected