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

Function runTest

test/parallel/test-runner-global-setup-teardown.mjs:15–76  ·  view source on GitHub ↗
(
  {
    isolation,
    globalSetupFile,
    testFiles = ['test-file.js'],
    env = {},
    additionalFlags = [],
    runnerEnabled = true,
  }
)

Source from the content-addressed store, hash-verified

13const onlyWithAmaro = { skip: !process.config.variables.node_use_amaro };
14
15async function runTest(
16 {
17 isolation,
18 globalSetupFile,
19 testFiles = ['test-file.js'],
20 env = {},
21 additionalFlags = [],
22 runnerEnabled = true,
23 }
24) {
25 const globalSetupPath = join(testFixtures, 'global-setup-teardown', globalSetupFile);
26
27 const args = [];
28
29 if (runnerEnabled) {
30 args.push('--test');
31 }
32
33 if (isolation) {
34 args.push(`--test-isolation=${isolation}`);
35 }
36
37 args.push(
38 '--test-reporter=spec',
39 `--test-global-setup=${globalSetupPath}`
40 );
41
42 if (additionalFlags.length > 0) {
43 args.push(...additionalFlags);
44 }
45
46 const testFilePaths = testFiles.map((file) => join(testFixtures, 'global-setup-teardown', file));
47 args.push(...testFilePaths);
48
49 const child = spawn(
50 process.execPath,
51 args,
52 {
53 encoding: 'utf8',
54 stdio: 'pipe',
55 env: {
56 ...process.env,
57 ...env
58 }
59 }
60 );
61
62 let stdout = '';
63 let stderr = '';
64
65 child.stdout.on('data', (data) => {
66 stdout += data.toString();
67 });
68
69 child.stderr.on('data', (data) => {
70 stderr += data.toString();
71 });
72

Calls 7

spawnFunction · 0.70
onceFunction · 0.70
mapMethod · 0.65
joinFunction · 0.50
pushMethod · 0.45
onMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…