(tests: Array<Test>)
| 380 | } |
| 381 | |
| 382 | async _setupReporters(tests: Array<Test>) { |
| 383 | const {collectCoverage: coverage, notify} = this._globalConfig; |
| 384 | const verbose = |
| 385 | this._globalConfig.verbose || tests.some(t => t.context.config.verbose); |
| 386 | const reporters = this._globalConfig.reporters || [ |
| 387 | [detectAgent() ? 'agent' : 'default', {}], |
| 388 | ]; |
| 389 | let summaryOptions: SummaryReporterOptions | null = null; |
| 390 | |
| 391 | for (const [reporter, options] of reporters) { |
| 392 | switch (reporter) { |
| 393 | case 'agent': |
| 394 | summaryOptions = options; |
| 395 | this.addReporter(new AgentReporter(this._globalConfig)); |
| 396 | break; |
| 397 | case 'default': |
| 398 | summaryOptions = options; |
| 399 | this.addReporter( |
| 400 | verbose |
| 401 | ? new VerboseReporter(this._globalConfig) |
| 402 | : new DefaultReporter(this._globalConfig), |
| 403 | ); |
| 404 | break; |
| 405 | case 'github-actions': |
| 406 | if (GITHUB_ACTIONS) { |
| 407 | this.addReporter( |
| 408 | new GitHubActionsReporter(this._globalConfig, options), |
| 409 | ); |
| 410 | } |
| 411 | break; |
| 412 | case 'summary': |
| 413 | summaryOptions = options; |
| 414 | break; |
| 415 | default: |
| 416 | await this._addCustomReporter(reporter, options); |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | if (notify) { |
| 421 | this.addReporter(new NotifyReporter(this._globalConfig, this._context)); |
| 422 | } |
| 423 | |
| 424 | if (coverage) { |
| 425 | this.addReporter(new CoverageReporter(this._globalConfig, this._context)); |
| 426 | } |
| 427 | |
| 428 | if (summaryOptions != null) { |
| 429 | this.addReporter(new SummaryReporter(this._globalConfig, summaryOptions)); |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | private async _addCustomReporter( |
| 434 | reporter: string, |
no test coverage detected