(/** @type {TestFile} */ test, isFinalRun, isRetry)
| 512 | let hadFailures = false |
| 513 | |
| 514 | const runTestOnce = (/** @type {TestFile} */ test, isFinalRun, isRetry) => |
| 515 | new Promise((resolve, reject) => { |
| 516 | const start = new Date().getTime() |
| 517 | let outputChunks = [] |
| 518 | |
| 519 | const args = [ |
| 520 | ...(process.env.CI ? ['--ci'] : []), |
| 521 | '--runInBand', |
| 522 | '--forceExit', |
| 523 | '--no-cache', |
| 524 | '--verbose', |
| 525 | ...(isTestJob |
| 526 | ? ['--json', `--outputFile=${test.file}${RESULTS_EXT}`] |
| 527 | : []), |
| 528 | test.file, |
| 529 | ...(test.excludedCases.length === 0 |
| 530 | ? [] |
| 531 | : [ |
| 532 | '--testNamePattern', |
| 533 | `^(?!(?:${test.excludedCases.map(escapeRegexp).join('|')})$).`, |
| 534 | ]), |
| 535 | ] |
| 536 | const deferNextTestWasm = !!process.env.NEXT_TEST_WASM |
| 537 | const env = { |
| 538 | // run tests in headless mode by default |
| 539 | HEADLESS: 'true', |
| 540 | NEXT_TELEMETRY_DISABLED: '1', |
| 541 | // unset CI env so CI behavior is only explicitly |
| 542 | // tested when enabled |
| 543 | CI: '', |
| 544 | // But some tests need to fork based on machine? CI? behavior differences |
| 545 | // Only use this in tests. |
| 546 | // For implementation forks, use `process.env.CI` instead |
| 547 | NEXT_TEST_CI: process.env.CI, |
| 548 | |
| 549 | ...(options.local |
| 550 | ? {} |
| 551 | : { |
| 552 | IS_RETRY: isRetry ? 'true' : undefined, |
| 553 | TRACE_PLAYWRIGHT: 'true', |
| 554 | CIRCLECI: '', |
| 555 | GITHUB_ACTIONS: '', |
| 556 | CONTINUOUS_INTEGRATION: '', |
| 557 | RUN_ID: '', |
| 558 | BUILD_NUMBER: '', |
| 559 | // Format the output of junit report to include the test name |
| 560 | // For the debugging purpose to compare actual run list to the generated reports |
| 561 | // [NOTE]: This won't affect if junit reporter is not enabled |
| 562 | JEST_JUNIT_OUTPUT_NAME: test.file.replaceAll('/', '_'), |
| 563 | // Specify suite name for the test to avoid unexpected merging across different env / grouped tests |
| 564 | // This is not individual suites name (corresponding 'describe'), top level suite name which have redundant names by default |
| 565 | // [NOTE]: This won't affect if junit reporter is not enabled |
| 566 | JEST_SUITE_NAME: [ |
| 567 | `${process.env.NEXT_TEST_MODE ?? 'default'}`, |
| 568 | options.group, |
| 569 | options.type, |
| 570 | test.file, |
| 571 | ] |
no test coverage detected
searching dependent graphs…