Skip to content

Commit

Permalink
cherry-pick(#21976): chore(ui): do not print global setup epilogue
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman authored and aslushnikov committed Mar 25, 2023
1 parent 1869bd2 commit 847b546
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/playwright-test/src/reporters/base.ts
Expand Up @@ -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}`);
}

Expand Down
7 changes: 5 additions & 2 deletions packages/playwright-test/src/reporters/list.ts
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion packages/playwright-test/src/runner/uiMode.ts
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = {
Expand Down
1 change: 0 additions & 1 deletion tests/playwright-test/exit-code.spec.ts
Expand Up @@ -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 }) => {
Expand Down

0 comments on commit 847b546

Please sign in to comment.