Skip to content

Support passing reporter options via CLI #10650

Description

@hi-ogawa

Clear and concise description of the problem

Reporter options can only be set in the config file via the tuple form reporters: [['json', { outputFile: '...' }]]. There's no CLI equivalent, except the special-cased top-level --outputFile.

So options like junit includeConsoleOutput or default summary can't be overridden from the CLI, which is awkward for CI/matrix jobs. We even ship bespoke env vars per option to work around this (e.g. VITEST_BLOB_LABEL for the blob reporter's label), which doesn't scale.

Suggested solution

Support --reporterOption.<name>.<option>, merged into the reporter's options (CLI over config):

vitest --reporter=json --reporterOption.json.outputFile=./out.json
vitest --reporter=junit --reporterOption.junit.includeConsoleOutput=false
vitest --reporter=default --reporterOption.default.summary=false
vitest --reporter=blob --reporterOption.blob.label=linux

Alternative

  • Dedicated per-option flags or env vars (e.g. --junitIncludeConsoleOutput, VITEST_BLOB_LABEL) — doesn't scale, one-off per option.
  • Env-var/config branching — the current workaround.

Additional context

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat: reportersIssues and PRs related to Vitest reporters

    Projects

    Status
    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions