fix(test runner): print flaky tests summary in yellow, not in red (#8951)

This commit is contained in:
Dmitry Gozman 2021-09-15 16:28:57 -07:00 committed by GitHub
parent 545d793956
commit 9b08871b4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,11 +121,13 @@ export class BaseReporter implements Reporter {
console.log('');
if (unexpected.length) {
console.log(colors.red(` ${unexpected.length} failed`));
this._printTestHeaders(unexpected);
for (const test of unexpected)
console.log(colors.red(formatTestHeader(this.config, test, ' ')));
}
if (flaky.length) {
console.log(colors.red(` ${flaky.length} flaky`));
this._printTestHeaders(flaky);
console.log(colors.yellow(` ${flaky.length} flaky`));
for (const test of flaky)
console.log(colors.yellow(formatTestHeader(this.config, test, ' ')));
}
if (skipped)
console.log(colors.yellow(` ${skipped} skipped`));
@ -135,12 +137,6 @@ export class BaseReporter implements Reporter {
console.log(colors.red(` Timed out waiting ${this.config.globalTimeout / 1000}s for the entire test run`));
}
private _printTestHeaders(tests: TestCase[]) {
tests.forEach(test => {
console.log(formatTestHeader(this.config, test, ' '));
});
}
private _printFailures(failures: TestCase[]) {
failures.forEach((test, index) => {
console.log(formatFailure(this.config, test, index + 1, this.printTestOutput));
@ -154,7 +150,7 @@ export class BaseReporter implements Reporter {
export function formatFailure(config: FullConfig, test: TestCase, index?: number, stdio?: boolean): string {
const lines: string[] = [];
lines.push(formatTestHeader(config, test, ' ', index));
lines.push(colors.red(formatTestHeader(config, test, ' ', index)));
for (const result of test.results) {
const resultTokens = formatResultFailure(test, result, ' ');
if (!resultTokens.length)
@ -239,7 +235,7 @@ export function formatTestTitle(config: FullConfig, test: TestCase, step?: TestS
function formatTestHeader(config: FullConfig, test: TestCase, indent: string, index?: number): string {
const title = formatTestTitle(config, test);
const header = `${indent}${index ? index + ') ' : ''}${title}`;
return colors.red(pad(header, '='));
return pad(header, '=');
}
export function formatError(error: TestError, file?: string) {