(path, filesWatcher, opts)
| 490 | } |
| 491 | |
| 492 | function runTestFile(path, filesWatcher, opts) { |
| 493 | const watchMode = filesWatcher != null; |
| 494 | const testPath = path === kIsolatedProcessName ? '' : path; |
| 495 | const testOpts = { __proto__: null, signal: opts.signal }; |
| 496 | const subtest = opts.root.createSubtest(FileTest, testPath, testOpts, async (t) => { |
| 497 | const args = getRunArgs(path, opts); |
| 498 | const stdio = ['pipe', 'pipe', 'pipe']; |
| 499 | const env = { __proto__: null, NODE_TEST_CONTEXT: 'child-v8', ...(opts.env || process.env) }; |
| 500 | |
| 501 | // Acquire a worker ID from the pool for process isolation mode |
| 502 | let workerId; |
| 503 | if (opts.workerIdPool) { |
| 504 | workerId = opts.workerIdPool.acquire(); |
| 505 | env.NODE_TEST_WORKER_ID = String(workerId); |
| 506 | debug('Assigned worker ID %d to test file: %s', workerId, path); |
| 507 | } |
| 508 | |
| 509 | if (watchMode) { |
| 510 | stdio.push('ipc'); |
| 511 | env.WATCH_REPORT_DEPENDENCIES = '1'; |
| 512 | } |
| 513 | if (opts.root.harness.shouldColorizeTestFiles) { |
| 514 | env.FORCE_COLOR = '1'; |
| 515 | } |
| 516 | |
| 517 | const child = spawn( |
| 518 | process.execPath, args, |
| 519 | { |
| 520 | __proto__: null, |
| 521 | signal: t.signal, |
| 522 | encoding: 'utf8', |
| 523 | env, |
| 524 | stdio, |
| 525 | cwd: opts.cwd, |
| 526 | }, |
| 527 | ); |
| 528 | if (watchMode) { |
| 529 | filesWatcher.runningProcesses.set(path, child); |
| 530 | filesWatcher.watcher.watchChildProcessModules(child, path); |
| 531 | } |
| 532 | |
| 533 | let err; |
| 534 | |
| 535 | child.on('error', (error) => { |
| 536 | err = error; |
| 537 | }); |
| 538 | |
| 539 | child.stdout.on('data', (data) => { |
| 540 | subtest.parseMessage(data); |
| 541 | }); |
| 542 | |
| 543 | const rl = new Interface({ __proto__: null, input: child.stderr }); |
| 544 | rl.on('line', (line) => { |
| 545 | if (isInspectorMessage(line)) { |
| 546 | process.stderr.write(line + '\n'); |
| 547 | return; |
| 548 | } |
| 549 |
no test coverage detected
searching dependent graphs…