Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## pr/clap-4.6 #529 +/- ##
================================================
+ Coverage 83.09% 99.64% +16.54%
================================================
Files 4 4
Lines 278 278
================================================
+ Hits 231 277 +46
+ Misses 47 1 -46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
A moderate active finding remains because the Unix execution test fixture hard-codes /bin/sh, which can break on systems without that path (e.g., Nix-style layouts), so the change needs a more portable shell resolution approach.
1 open issue
What changed in this PR
Replaces legacy randomized shell smoke tests with deterministic Rust CLI integration tests and supporting fixtures/snapshots so coverage runs reliably in CI.
Changes:
- Add
assert_cmd/predicates-based CLI integration tests covering core retry and argument behaviors. - Introduce a deterministic Unix fixture and snapshot files for stable output assertions.
- Remove obsolete
tests/smoke/*shell scripts and document snapshot updates.
| File | Description |
|---|---|
| tests/support/fixture.rs | Adds a Rust test fixture that sets up a tempdir-backed invocation counter and helpers to run the CLI against the deterministic child program. |
| tests/support/child.sh | Adds a deterministic Unix shell child script used by integration tests to simulate repeated failures, eventual success, and signal termination. |
| tests/snapshots/version.stdout | Adds a snapshot file capturing the expected --version standard output. |
| tests/snapshots/no-command.stderr | Adds a snapshot file capturing the expected error output when no command is provided. |
| tests/smoke/test-no-options.t.sh | Removes a legacy randomized shell smoke test script that was not reliably exercised in CI. |
| tests/smoke/no-arguments.t.sh | Removes a legacy shell smoke test script for the no-arguments case. |
| tests/smoke/commands/test.sh | Removes the legacy randomized shell test command helper used by the old smoke tests. |
| tests/README.md | Documents how the new CLI integration tests and snapshots work and how to update the snapshot expectations. |
| tests/cli.rs | Adds deterministic Rust integration tests for CLI behavior (no command, retries/limits, invalid flags, signal termination, and argument pass-through) using assert_cmd and snapshots. |
| Cargo.toml | Updates dev-dependencies to include the crates needed for the new integration test suite. |
| Cargo.lock | Updates the lockfile to reflect the newly added test-related dependencies. |
Review effort: Balanced
| pub fn command(&self, mut command: Command) -> Command { | ||
| command | ||
| .arg("/bin/sh") | ||
| .arg(self.path("child.sh")) | ||
| .arg(self.path("count")) | ||
| .arg(self.path("arguments")) | ||
| .arg(&self.mode); | ||
| command | ||
| } |

Replaces the randomized shell smoke tests (they used
$RANDOM, and CI never ran them) with deterministic Rust integration tests intests/cli.rs, resolving #101 and #1.assert_cmd+predicates, with a fixture (tests/support/) that counts invocations in a temp dir and succeeds on the Nth call, so tests are fast and deterministic.-xlimits; invalid-x; a child killed by a signal; arguments after the command passed through verbatim.--versionand the no-command error;tests/README.mdexplains how to update them.-xexits 0.Verification: fmt, clippy, tests (default and all features), Rust 1.88; repeated runs showed no flakiness (about 0.2 s per run).
Closes #101
Closes #1
Stack (merge bottom-up; each PR targets the one below it):