MCPcopy Create free account
hub / github.com/babel/babel / test

Function test

test/runtime-integration/node-versions.mjs:121–137  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

119}
120
121function test(dir) {
122 return new Promise((resolve, reject) => {
123 const child = spawn(path.join(dir, NODE_BINARY), [SCRIPT], {
124 // node.cjs spawns `node`, which must be the version under test.
125 env: {
126 ...process.env,
127 PATH: `${dir}${path.delimiter}${process.env.PATH}`,
128 },
129 });
130 let output = "";
131 const append = chunk => (output += chunk);
132 child.stdout.on("data", append);
133 child.stderr.on("data", append);
134 child.on("error", reject);
135 child.on("close", code => resolve({ ok: code === 0, output }));
136 });
137}

Callers 1

node-versions.mjsFile · 0.70

Calls 3

spawnFunction · 0.85
onMethod · 0.80
resolveFunction · 0.70

Tested by

no test coverage detected