fix(cli): reject an empty --reporter instead of running with no reporters

Merged
SA
21d ago
+26-5

What and why

  • --reporter '', --reporter ',', or --reporter "$REPORTERS" with the variable unset parsed to [], and that list replaced every configured reporter. A failing run printed nothing to the terminal and exited 1.
  • parseReporters (packages/e2e/src/cli/index.ts:145) now throws InvalidArgumentError('must name at least one reporter') on an empty list. That makes it a usage error with exit 2, matching parseNames for --tag, --target, --agent, and --exclude-tag. run and explore share the parser, so both are covered.
  • docs/reference/cli.mdx and the running.md skill reference say an empty --reporter is a usage error. Patch changeset for e2e.
  • Left alone: reporters: [] in the config still runs with no built-in reporters. Before this change, --reporter '' was an undocumented way to keep only the config's reporter objects; that use now needs the config.

Issue

Fixes #1352

Verified

Ran it locally: yes

  • testbed, built CLI (node node_modules/e2e/dist/cli/bin.js), with a scratch test that fails on purpose (expect(1).toBe(2)), run on main's build and then on this branch's build.
commandmainthis branch
run --reporter ''no output, exit 1error: option '--reporter <ids>' argument '' is invalid. must name at least one reporter, exit 2, no run
run --reporter ','no output, exit 1error: option '--reporter <ids>' argument ',' is invalid. must name at least one reporter, exit 2, no run
explore --reporter ''not run on main (same parser as run)same usage error, exit 2
run --reporter listlist output, 1 failed, exit 1unchanged
run (config reporters)list output, 1 failed, exit 1unchanged
  • A normal run on this branch, e2e run tests/forms.e2e.ts, gives Tests 5 passed (5) and exit 0.
  • New unit test: rejects an empty --reporter on run and explore with exit code 2 instead of running with no reporters (packages/e2e/tests/unit/cli.test.ts). It fails on main because the exit code is 0, and passes here.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

🤖 Generated with Claude Code