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

This commit is contained in:
Pavel Feldman 2023-03-24 20:56:45 -07:00 committed by Andrey Lushnikov
parent 1869bd28d6
commit 847b546794
4 changed files with 9 additions and 4 deletions

View file

@ -124,6 +124,8 @@ export class BaseReporter implements Reporter {
protected generateStartingMessage() { protected generateStartingMessage() {
const jobs = Math.min(this.config.workers, this.config._internal.maxConcurrentTestGroups); 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}` : ''; 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}`); return '\n' + colors.dim('Running ') + this.totalTestCount + colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
} }

View file

@ -47,9 +47,12 @@ class ListReporter extends BaseReporter {
override onBegin(config: FullConfig, suite: Suite) { override onBegin(config: FullConfig, suite: Suite) {
super.onBegin(config, suite); super.onBegin(config, suite);
console.log(this.generateStartingMessage()); const startingMessage = this.generateStartingMessage();
if (startingMessage) {
console.log(startingMessage);
console.log(); console.log();
} }
}
onTestBegin(test: TestCase, result: TestResult) { onTestBegin(test: TestCase, result: TestResult) {
if (this._liveTerminal) if (this._liveTerminal)

View file

@ -28,6 +28,7 @@ import { createTaskRunnerForList, createTaskRunnerForWatch, createTaskRunnerForW
import { chokidar } from '../utilsBundle'; import { chokidar } from '../utilsBundle';
import type { FSWatcher } from 'chokidar'; import type { FSWatcher } from 'chokidar';
import { open } from '../utilsBundle'; import { open } from '../utilsBundle';
import ListReporter from '../reporters/list';
class UIMode { class UIMode {
private _config: FullConfigInternal; private _config: FullConfigInternal;
@ -66,7 +67,7 @@ class UIMode {
} }
async runGlobalSetup(): Promise<FullResult['status']> { async runGlobalSetup(): Promise<FullResult['status']> {
const reporter = await createReporter(this._config, 'run'); const reporter = new Multiplexer([new ListReporter()]);
const taskRunner = createTaskRunnerForWatchSetup(this._config, reporter); const taskRunner = createTaskRunnerForWatchSetup(this._config, reporter);
reporter.onConfigure(this._config); reporter.onConfigure(this._config);
const context: TaskRunnerState = { const context: TaskRunnerState = {

View file

@ -163,7 +163,6 @@ test('should exit with code 0 with --pass-with-no-tests', async ({ runInlineTest
`, `,
}, undefined, undefined, { additionalArgs: ['--pass-with-no-tests'] }); }, undefined, undefined, { additionalArgs: ['--pass-with-no-tests'] });
expect(result.exitCode).toBe(0); 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 }) => { test('should exit with code 1 when config is not found', async ({ runInlineTest }) => {