(
testContexts: Set<TestContext>,
aggregatedResults: AggregatedResult,
watcher: TestWatcher,
allTests: Array<Test>,
)
| 450 | } |
| 451 | |
| 452 | private async _bailIfNeeded( |
| 453 | testContexts: Set<TestContext>, |
| 454 | aggregatedResults: AggregatedResult, |
| 455 | watcher: TestWatcher, |
| 456 | allTests: Array<Test>, |
| 457 | ): Promise<void> { |
| 458 | if ( |
| 459 | this._globalConfig.bail !== 0 && |
| 460 | aggregatedResults.numFailedTests >= this._globalConfig.bail |
| 461 | ) { |
| 462 | if (watcher.isWatchMode()) { |
| 463 | await watcher.setState({interrupted: true}); |
| 464 | return; |
| 465 | } |
| 466 | |
| 467 | try { |
| 468 | await this._dispatcher.onRunComplete(testContexts, aggregatedResults); |
| 469 | } finally { |
| 470 | // Perform global teardown if client configures `bail` |
| 471 | if (allTests.length > 0) { |
| 472 | performance.mark('jest/globalTeardown:start'); |
| 473 | await runGlobalHook({ |
| 474 | allTests, |
| 475 | globalConfig: this._globalConfig, |
| 476 | moduleName: 'globalTeardown', |
| 477 | }); |
| 478 | performance.mark('jest/globalTeardown:end'); |
| 479 | exit(this._globalConfig.testFailureExitCode); |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | const createAggregatedResults = (numTotalTestSuites: number) => { |
no test coverage detected