| 19 | import type { test } from '../common'; |
| 20 | |
| 21 | export class Multiplexer implements ReporterV2 { |
| 22 | private _reporters: ReporterV2[]; |
| 23 | |
| 24 | constructor(reporters: ReporterV2[]) { |
| 25 | this._reporters = reporters; |
| 26 | } |
| 27 | |
| 28 | version(): 'v2' { |
| 29 | return 'v2'; |
| 30 | } |
| 31 | |
| 32 | onConfigure(config: FullConfig) { |
| 33 | for (const reporter of this._reporters) |
| 34 | wrap(() => reporter.onConfigure?.(config)); |
| 35 | } |
| 36 | |
| 37 | onBegin(suite: test.Suite) { |
| 38 | for (const reporter of this._reporters) |
| 39 | wrap(() => reporter.onBegin?.(suite)); |
| 40 | } |
| 41 | |
| 42 | onTestBegin(test: TestCase, result: TestResult) { |
| 43 | for (const reporter of this._reporters) |
| 44 | wrap(() => reporter.onTestBegin?.(test, result)); |
| 45 | } |
| 46 | |
| 47 | onStdOut(chunk: string | Buffer, test?: TestCase, result?: TestResult) { |
| 48 | for (const reporter of this._reporters) |
| 49 | wrap(() => reporter.onStdOut?.(chunk, test, result)); |
| 50 | } |
| 51 | |
| 52 | onStdErr(chunk: string | Buffer, test?: TestCase, result?: TestResult) { |
| 53 | for (const reporter of this._reporters) |
| 54 | wrap(() => reporter.onStdErr?.(chunk, test, result)); |
| 55 | } |
| 56 | |
| 57 | async onTestPaused(test: TestCase, result: TestResult) { |
| 58 | for (const reporter of this._reporters) |
| 59 | await wrapAsync(() => reporter.onTestPaused?.(test, result)); |
| 60 | } |
| 61 | |
| 62 | onTestEnd(test: TestCase, result: TestResult) { |
| 63 | for (const reporter of this._reporters) |
| 64 | wrap(() => reporter.onTestEnd?.(test, result)); |
| 65 | } |
| 66 | |
| 67 | onReportConfigure(params: ReportConfigureParams): void { |
| 68 | for (const reporter of this._reporters) |
| 69 | wrap(() => reporter.onReportConfigure?.(params)); |
| 70 | } |
| 71 | |
| 72 | onReportEnd(params: ReportEndParams): void { |
| 73 | for (const reporter of this._reporters) |
| 74 | wrap(() => reporter.onReportEnd?.(params)); |
| 75 | } |
| 76 | |
| 77 | async onEnd(result: FullResult) { |
| 78 | for (const reporter of this._reporters) { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…