fix(test runner): remove test output for failures (#11308)
This commit is contained in:
parent
14fd837e94
commit
d36ff8a96c
|
|
@ -58,10 +58,9 @@ export class BaseReporter implements Reporter {
|
||||||
suite!: Suite;
|
suite!: Suite;
|
||||||
totalTestCount = 0;
|
totalTestCount = 0;
|
||||||
result!: FullResult;
|
result!: FullResult;
|
||||||
fileDurations = new Map<string, number>();
|
private fileDurations = new Map<string, number>();
|
||||||
monotonicStartTime: number = 0;
|
private monotonicStartTime: number = 0;
|
||||||
private printTestOutput = !process.env.PWTEST_SKIP_TEST_OUTPUT;
|
private _omitFailures: boolean;
|
||||||
protected _omitFailures: boolean;
|
|
||||||
private readonly _ttyWidthForTest: number;
|
private readonly _ttyWidthForTest: number;
|
||||||
|
|
||||||
constructor(options: { omitFailures?: boolean } = {}) {
|
constructor(options: { omitFailures?: boolean } = {}) {
|
||||||
|
|
@ -196,7 +195,6 @@ export class BaseReporter implements Reporter {
|
||||||
failures.forEach((test, index) => {
|
failures.forEach((test, index) => {
|
||||||
console.log(formatFailure(this.config, test, {
|
console.log(formatFailure(this.config, test, {
|
||||||
index: index + 1,
|
index: index + 1,
|
||||||
includeStdio: this.printTestOutput
|
|
||||||
}).message);
|
}).message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
import { test, expect, stripAscii } from './playwright-test-fixtures';
|
import { test, expect, stripAscii } from './playwright-test-fixtures';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import colors from 'colors/safe';
|
|
||||||
|
|
||||||
test('handle long test names', async ({ runInlineTest }) => {
|
test('handle long test names', async ({ runInlineTest }) => {
|
||||||
const title = 'title'.repeat(30);
|
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');
|
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 }) => {
|
test('should print flaky failures', async ({ runInlineTest }) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'a.spec.ts': `
|
'a.spec.ts': `
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue