TerminalReporter display of warnings
This commit is contained in:
parent
a462b68655
commit
be4e107c85
|
|
@ -270,6 +270,7 @@ export class TerminalReporter implements ReporterV2 {
|
|||
if (full && summary.failuresToPrint.length && !this._omitFailures)
|
||||
this._printFailures(summary.failuresToPrint);
|
||||
this._printSlowTests();
|
||||
this._printWarnings();
|
||||
this._printSummary(summaryMessage);
|
||||
}
|
||||
|
||||
|
|
@ -289,6 +290,28 @@ export class TerminalReporter implements ReporterV2 {
|
|||
console.log(this.screen.colors.yellow(' Consider running tests from slow files in parallel, see https://playwright.dev/docs/test-parallel.'));
|
||||
}
|
||||
|
||||
private _printWarnings() {
|
||||
const warningTests = this.suite.allTests().filter(test => test.annotations.some(a => a.type === 'warning'));
|
||||
const encounteredWarnings = new Map<string, Array<TestCase>>();
|
||||
for (const test of warningTests) {
|
||||
for (const annotation of test.annotations) {
|
||||
if (annotation.type !== 'warning' || annotation.description === undefined)
|
||||
continue;
|
||||
let tests = encounteredWarnings.get(annotation.description);
|
||||
if (!tests) {
|
||||
tests = [];
|
||||
encounteredWarnings.set(annotation.description, tests);
|
||||
}
|
||||
tests.push(test);
|
||||
}
|
||||
}
|
||||
for (const [description, tests] of encounteredWarnings) {
|
||||
console.log(this.screen.colors.yellow(' Warning: ') + description);
|
||||
for (const test of tests)
|
||||
console.log(this.formatTestHeader(test, { indent: ' ', mode: 'default' }));
|
||||
}
|
||||
}
|
||||
|
||||
private _printSummary(summary: string) {
|
||||
if (summary.trim())
|
||||
console.log(summary);
|
||||
|
|
|
|||
Loading…
Reference in a new issue