Skip to content

Commit 847b546

Browse files
pavelfeldmanaslushnikov
authored andcommitted
cherry-pick(#21976): chore(ui): do not print global setup epilogue
1 parent 1869bd2 commit 847b546

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

packages/playwright-test/src/reporters/base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ export class BaseReporter implements Reporter {
124124
protected generateStartingMessage() {
125125
const jobs = Math.min(this.config.workers, this.config._internal.maxConcurrentTestGroups);
126126
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
127+
if (!this.totalTestCount)
128+
return '';
127129
return '\n' + colors.dim('Running ') + this.totalTestCount + colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
128130
}
129131

packages/playwright-test/src/reporters/list.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ class ListReporter extends BaseReporter {
4747

4848
override onBegin(config: FullConfig, suite: Suite) {
4949
super.onBegin(config, suite);
50-
console.log(this.generateStartingMessage());
51-
console.log();
50+
const startingMessage = this.generateStartingMessage();
51+
if (startingMessage) {
52+
console.log(startingMessage);
53+
console.log();
54+
}
5255
}
5356

5457
onTestBegin(test: TestCase, result: TestResult) {

packages/playwright-test/src/runner/uiMode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { createTaskRunnerForList, createTaskRunnerForWatch, createTaskRunnerForW
2828
import { chokidar } from '../utilsBundle';
2929
import type { FSWatcher } from 'chokidar';
3030
import { open } from '../utilsBundle';
31+
import ListReporter from '../reporters/list';
3132

3233
class UIMode {
3334
private _config: FullConfigInternal;
@@ -66,7 +67,7 @@ class UIMode {
6667
}
6768

6869
async runGlobalSetup(): Promise<FullResult['status']> {
69-
const reporter = await createReporter(this._config, 'run');
70+
const reporter = new Multiplexer([new ListReporter()]);
7071
const taskRunner = createTaskRunnerForWatchSetup(this._config, reporter);
7172
reporter.onConfigure(this._config);
7273
const context: TaskRunnerState = {

tests/playwright-test/exit-code.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ test('should exit with code 0 with --pass-with-no-tests', async ({ runInlineTest
163163
`,
164164
}, undefined, undefined, { additionalArgs: ['--pass-with-no-tests'] });
165165
expect(result.exitCode).toBe(0);
166-
expect(result.output).toContain(`Running 0 tests using 0 workers`);
167166
});
168167

169168
test('should exit with code 1 when config is not found', async ({ runInlineTest }) => {

0 commit comments

Comments
 (0)