MCPcopy
hub / github.com/microsoft/playwright / InternalReporter

Class InternalReporter

packages/playwright/src/reporters/internalReporter.ts:31–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31export class InternalReporter implements ReporterV2 {
32 private _reporter: ReporterV2;
33 private _didBegin = false;
34 private _config!: FullConfig;
35 private _startTime: Date | undefined;
36 private _monotonicStartTime: number | undefined;
37
38 constructor(reporters: AnyReporter[]) {
39 this._reporter = new Multiplexer(reporters.map(wrapReporterAsV2));
40 }
41
42 version(): 'v2' {
43 return 'v2';
44 }
45
46 onConfigure(config: FullConfig) {
47 this._config = config;
48 this._startTime = new Date();
49 this._monotonicStartTime = monotonicTime();
50 this._reporter.onConfigure?.(config);
51 }
52
53 onBegin(suite: testNs.Suite) {
54 this._didBegin = true;
55 this._reporter.onBegin?.(suite);
56 }
57
58 onTestBegin(test: TestCase, result: TestResult) {
59 this._reporter.onTestBegin?.(test, result);
60 }
61
62 onStdOut(chunk: string | Buffer, test?: TestCase, result?: TestResult) {
63 this._reporter.onStdOut?.(chunk, test, result);
64 }
65
66 onStdErr(chunk: string | Buffer, test?: TestCase, result?: TestResult) {
67 this._reporter.onStdErr?.(chunk, test, result);
68 }
69
70 async onTestPaused(test: TestCase, result: TestResult) {
71 this._addSnippetToTestErrors(test, result);
72 return await this._reporter.onTestPaused?.(test, result);
73 }
74
75 onTestEnd(test: TestCase, result: TestResult) {
76 this._addSnippetToTestErrors(test, result);
77 this._reporter.onTestEnd?.(test, result);
78 }
79
80 async onEnd(result: { status: FullResult['status'] }) {
81 if (!this._didBegin) {
82 // onBegin was not reported, emit it.
83 this.onBegin(new testNs.Suite('', 'root'));
84 }
85 return await this._reporter.onEnd?.({
86 ...result,
87 startTime: this._startTime!,
88 duration: monotonicTime() - this._monotonicStartTime!,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…