vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Disable summary for default reporter via cli

Open Daimon-EuDaimon opened this issue 7 months ago • 3 comments

Clear and concise description of the problem

We use CLI to run tests in CI vitest --run --reporter=basic --reporter=github-actions

But the basic reporter is deprecated and tests output

DEPRECATED  'basic' reporter is deprecated and will be removed in Vitest v3.
Remove 'basic' from 'reporters' option. To match 'basic' reporter 100%, use configuration:
{
 "test": {
   "reporters": [
     [
       "default",
       {
         "summary": false
       }
     ]
   ]
 }
}

It is much easier to configure Vitest via CLI rather than using a config file in our pipelines. So we would like to configure the reporter via CLI.

Suggested solution

Add CLI option --reporter.summary. This option may affect all reporters

Alternative

Or add options parsing and matching them with reporters by name, for example --reporter.default.summary=true, --reporter.verbose.summary=false

This format may work for other reporter options in the future

Additional context

No response

Validations

Daimon-EuDaimon avatar Jun 02 '25 12:06 Daimon-EuDaimon

Configuring reporter options via CLI sounds good.

We use CLI to run tests in CI vitest --run --reporter=basic --reporter=github-actions

The summary of default reporter is disabled on CI. The command above should be equivalent to CI=true vitest --run --reporter=default --reporter=github-actions, no?

AriPerkkio avatar Jun 02 '25 13:06 AriPerkkio

Yes. But it is more straightforward to use one tool for configuration. Using CLI and envs is more complicated. Maybe adding ci as an option, rather than an environment variable is good alternative?

vitest --ci --reporter=default --reporter=github-actions

Daimon-EuDaimon avatar Jun 02 '25 14:06 Daimon-EuDaimon

@Daimon-EuDaimon just to be sure - this issue is about hiding summary in local environment only, even though you mention CI usage above? It's about having 100% same experience on local and on CI?

On CI you don't ever need to use summary: false as that's the default.

AriPerkkio avatar Jun 03 '25 05:06 AriPerkkio