fix(cli): reject an empty --reporter instead of running with no reporters
Merged
SA
21d ago+26+26+01234567890123456789-5-5-0123456789
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 throwsInvalidArgumentError('must name at least one reporter')on an empty list. That makes it a usage error with exit 2, matchingparseNamesfor--tag,--target,--agent, and--exclude-tag.runandexploreshare the parser, so both are covered.docs/reference/cli.mdxand therunning.mdskill reference say an empty--reporteris a usage error. Patch changeset fore2e.- 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.
| command | main | this branch |
|---|---|---|
run --reporter '' | no output, exit 1 | error: option '--reporter <ids>' argument '' is invalid. must name at least one reporter, exit 2, no run |
run --reporter ',' | no output, exit 1 | error: 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 list | list output, 1 failed, exit 1 | unchanged |
run (config reporters) | list output, 1 failed, exit 1 | unchanged |
- A normal run on this branch,
e2e run tests/forms.e2e.ts, givesTests 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/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
🤖 Generated with Claude Code