fix(test runner): remove test output for failures (#11308)

This commit is contained in:
Dmitry Gozman 2022-01-10 13:22:09 -08:00 committed by GitHub
parent 14fd837e94
commit d36ff8a96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 28 deletions

View File

@ -58,10 +58,9 @@ export class BaseReporter implements Reporter {
suite!: Suite;
totalTestCount = 0;
result!: FullResult;
fileDurations = new Map<string, number>();
monotonicStartTime: number = 0;
private printTestOutput = !process.env.PWTEST_SKIP_TEST_OUTPUT;
protected _omitFailures: boolean;
private fileDurations = new Map<string, number>();
private monotonicStartTime: number = 0;
private _omitFailures: boolean;
private readonly _ttyWidthForTest: number;
constructor(options: { omitFailures?: boolean } = {}) {
@ -196,7 +195,6 @@ export class BaseReporter implements Reporter {
failures.forEach((test, index) => {
console.log(formatFailure(this.config, test, {
index: index + 1,
includeStdio: this.printTestOutput
}).message);
});
}

View File

@ -16,7 +16,6 @@
import { test, expect, stripAscii } from './playwright-test-fixtures';
import * as path from 'path';
import colors from 'colors/safe';
test('handle long test names', async ({ runInlineTest }) => {
const title = 'title'.repeat(30);
@ -176,28 +175,6 @@ test('should not print slow tests', async ({ runInlineTest }) => {
expect(stripAscii(result.output)).not.toContain('Slow test');
});
test('should print stdio for failures', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.test.js': `
const { test } = pwt;
test('fails', async ({}) => {
console.log('my log 1');
console.error('my error');
console.log('my log 2');
expect(1).toBe(2);
});
`,
}, {}, { PWTEST_SKIP_TEST_OUTPUT: '' });
expect(result.exitCode).toBe(1);
expect(result.failed).toBe(1);
expect(result.output).toContain('Test output');
expect(result.output).toContain([
'my log 1\n',
colors.red('my error\n'),
'my log 2\n',
].join(''));
});
test('should print flaky failures', async ({ runInlineTest }) => {
const result = await runInlineTest({
'a.spec.ts': `