Repository navigation
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Batch-only flag validation and coverage src/commands/test.ts, src/commands/test.run.spec.ts, src/commands/test.run-ids.spec.ts, DOCUMENTATION.md |
The command rejects --allow-empty for one distinct test ID without --all. Tests cover rejection before network access and accepted empty batches for --all and multiple IDs. Documentation describes the restriction. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- Issue 376 identifies
test run <id> --allow-emptyas an ignored flag. This change adds validation for that command and flag.
Merge Risk: 
Minimal · up to 43be2
-
The change rejects the ignored flag for single-test runs while retaining it for batches. No merge-blocking issue is identified.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the main change:
test runnow refuses--allow-emptywhen a single test ID is given without--all. The raw summary and objectives confirm this is the primary change, with the validation added in src/commands/test.ts, tests added, and one documentation sentence updated. The title's parenthetical notes that only batches read the flag, which matches the change. The title is specific and sufficiently descriptive.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (2 skipped: 1 unsupported, 1 too large.)
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
|
🏆 Season 4 CLI Improvement Bonus: entry recorded. Thanks, @protonjls! To be counted, this PR needs the following by Oct 29, 11:59 PM PT:
Rewards go to merged PRs judged a genuine improvement, and up to three bonus-eligible PRs count per person. Untick the box to withdraw the entry. This comment refreshes when you edit the PR. Full rules. |
…ads it) `--allow-empty` softens the zero-dispatch gate of a batch run: `--all`, or several ids, which v0.16.0 dispatches as a batch. A single <test-id> never reaches that gate, so the flag was silently ignored: the run was triggered and the command exited 0. Refuse it there with exit 5 VALIDATION_ERROR (details.field `allow-empty`), next to the existing `--filter` / `--status` --all-only checks and worded like `test rerun --allow-empty`. Several ids keep honouring the flag; a control test covers a several-id batch whose answer skips every id. Part of TestSprite#376 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4eeae1b to
43be289
Compare
|
Rebased onto v0.16.0 (4b5ae55) to clear the conflict with the release. The guard is unchanged. v0.16.0 runs every several-id |
|
Thanks @protonjls, and sorry for the slow answer to the scoping question you raised on #376. You were right to raise it: since 0.16 a run with several ids is a batch that honours |
What does this PR do?
test run <test-id> --allow-emptywas accepted and silently ignored.--allow-emptyonly softens the zero-dispatch gate of a batch run, which exits 5 when a batch dispatches no tests. A single<test-id>never reaches that gate, so the flag had no effect: the run was triggered as if it weren't there.test rerunalready refuses--allow-emptywithout--all, andtest runalready refuses--filterwithout--all.This is part 2 of #376:
test runaction, right after the existing--filter/--statuschecks.--allow-emptywith a single<test-id>and no--allis refused before any request, with exit 5VALIDATION_ERROR,details.fieldallow-empty, and thenextAction"Flag--allow-emptyis invalid: --allow-empty only applies with --all or several test ids (it permits a batch that dispatches zero tests). Remove --allow-empty, or add --all with --project or TESTSPRITE_PROJECT_ID."--all(for example when the batch answer skips every id), whose error says "pass --allow-empty to exit 0 intentionally". The flag works there, so refusing it would be a regression. If you'd rather refuse it whenever--allis absent, exactly liketest rerun, I'll change it.test runsection.main, 4b5ae55 / v0.16.0)test run t1 --allow-empty(also with--wait,--local 3000, ort1 t1)details.fieldallow-empty, no requesttest run --all --project P --allow-emptytest run a b --allow-empty(several ids, a batch)Related issue
Part of #376
Thanks @zeshi-du for confirming #376 and splitting it into three PRs. This is part 2; part 1 is #598 and part 3 is tracked in #569.
Season 4 CLI Improvement Bonus
Discord username: 1149447580477042769
Type of change
Checklist
mainbranch.(
feat(...),fix(...),docs(...), …).npm run lintandnpm run format:checkpass.npm run typecheckpasses.npm testpasses and coverage stays at or above the 80% gate.credentials required).
README.md/DOCUMENTATION.mdwhererelevant.
Notes for reviewers
src/commands/test.run.spec.ts, next to<test-id> --filter (without --all) → exit 5):createTestCommand: plain,--wait,--local 3000 --skip-preflight, and a repeated id (test_xyz test_xyz, which runs one test). Each asserts exit 5,VALIDATION_ERROR,details.field, the exactnextAction, and zero fetch calls.run --all --project project_be --allow-emptyagainst an empty batch still exits 0 ("--allow-empty set — exiting 0").src/commands/test.run-ids.spec.ts, in "run : project grouping"):run a bwhose batch answer skips every id exits 5 with "pass --allow-empty to exit 0 intentionally" without the flag. With it, it exits 0 after the one batch request.main(4b5ae55, v0.16.0), exactly the 4 refusal cases fail, because the requests go out. Both controls pass on both commits.--allow-emptywith a single test id now gets exit 5 instead of a run. ThenextActionnames the fix. This is the same tradetest rerun --allow-emptyandtest run --filteralready make.main,test run test_x --allow-empty --target-url https://example.com --skip-preflight --no-waitsends the trigger request and exits 0, the same as without the flag. On this branch it exits 5 and sends nothing. Single-test runs without the flag, and--all --project P --allow-empty --dry-run, give the same exit code, request count and stdout on both commits.--allow-emptyhelp text is unchanged; it already reads "with --all: …".npm run lint,npm run format:check,npm run typecheck, the.github/scriptstests, build + smoke,npm run test:coverageandnpm run test:e2eall pass.test runas a batch, so the old several-id control (backend ids through the automatic tunnel) no longer applies; it is replaced by the batch control above. The guard itself is unchanged, and all the checks above were re-run on the rebased commit.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
test runnow rejects--allow-emptywhen used with exactly one distinct test ID, including when combined with--waitor--local. The command reports a validation error before making a network request.--all --allow-emptyor multiple test IDs with--allow-emptyremain accepted.Documentation
--allow-emptyapplies to batches, not a single test ID.