Skip to content

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

chore(ui): do not print global setup epilogue (#21976)

Pavel Feldmanc3d7ffb7731e
diff --git a/packages/playwright-test/src/reporters/base.ts b/packages/playwright-test/src/reporters/base.ts
index 4f6e376f33..645b581673 100644
--- a/packages/playwright-test/src/reporters/base.ts
+++ b/packages/playwright-test/src/reporters/base.ts
@@ -124,6 +124,8 @@ export class BaseReporter implements Reporter {
protected generateStartingMessage() {
const jobs = Math.min(this.config.workers, this.config._internal.maxConcurrentTestGroups);
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
+ if (!this.totalTestCount)
+ return '';
return '\n' + colors.dim('Running ') + this.totalTestCount + colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
}
diff --git a/packages/playwright-test/src/reporters/list.ts b/packages/playwright-test/src/reporters/list.ts
index 64de2254c0..5d394f3c2f 100644
--- a/packages/playwright-test/src/reporters/list.ts
+++ b/packages/playwright-test/src/reporters/list.ts
@@ -47,8 +47,11 @@ class ListReporter extends BaseReporter {
override onBegin(config: FullConfig, suite: Suite) {
super.onBegin(config, suite);
- console.log(this.generateStartingMessage());
- console.log();
+ const startingMessage = this.generateStartingMessage();
+ if (startingMessage) {
+ console.log(startingMessage);
+ console.log();
+ }
}
onTestBegin(test: TestCase, result: TestResult) {
diff --git a/packages/playwright-test/src/runner/uiMode.ts b/packages/playwright-test/src/runner/uiMode.ts
index aa69930580..bfbd0f467f 100644
--- a/packages/playwright-test/src/runner/uiMode.ts
+++ b/packages/playwright-test/src/runner/uiMode.ts
@@ -28,6 +28,7 @@ import { createTaskRunnerForList, createTaskRunnerForWatch, createTaskRunnerForW
import { chokidar } from '../utilsBundle';
import type { FSWatcher } from 'chokidar';
import { open } from '../utilsBundle';
+import ListReporter from '../reporters/list';
class UIMode {
private _config: FullConfigInternal;
@@ -66,7 +67,7 @@ class UIMode {
}
async runGlobalSetup(): Promise<FullResult['status']> {
- const reporter = await createReporter(this._config, 'run');
+ const reporter = new Multiplexer([new ListReporter()]);
const taskRunner = createTaskRunnerForWatchSetup(this._config, reporter);
reporter.onConfigure(this._config);
const context: TaskRunnerState = {
diff --git a/tests/playwright-test/exit-code.spec.ts b/tests/playwright-test/exit-code.spec.ts
index ec12328c57..65a26cd90a 100644
--- a/tests/playwright-test/exit-code.spec.ts
+++ b/tests/playwright-test/exit-code.spec.ts
@@ -163,7 +163,6 @@ test('should exit with code 0 with --pass-with-no-tests', async ({ runInlineTest
`,
}, undefined, undefined, { additionalArgs: ['--pass-with-no-tests'] });
expect(result.exitCode).toBe(0);
- expect(result.output).toContain(`Running 0 tests using 0 workers`);
});
test('should exit with code 1 when config is not found', async ({ runInlineTest }) => {