mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
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;
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
@ -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': `
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user