Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Dmitry Gozmand36ff8a96c35
diff --git a/packages/playwright-test/src/reporters/base.ts b/packages/playwright-test/src/reporters/base.ts
index a1edf86aa3..8d4a52d38c 100644
--- a/packages/playwright-test/src/reporters/base.ts
+++ b/packages/playwright-test/src/reporters/base.ts
@@ -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);
});
}
diff --git a/tests/playwright-test/reporter-base.spec.ts b/tests/playwright-test/reporter-base.spec.ts
index ccbde11dfb..faa9c4b018 100644
--- a/tests/playwright-test/reporter-base.spec.ts
+++ b/tests/playwright-test/reporter-base.spec.ts
@@ -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': `