Skip to content

test(cli): binary-level integration tests (#41)#92

Merged
Connorrmcd6 merged 1 commit into
mainfrom
test/41-binary-integration-tests
Jun 13, 2026
Merged

test(cli): binary-level integration tests (#41)#92
Connorrmcd6 merged 1 commit into
mainfrom
test/41-binary-integration-tests

Conversation

@Connorrmcd6

Copy link
Copy Markdown
Owner

Closes #41.

Unit coverage is solid, but nothing invoked the built surf binary — exit codes, human output, and the versioned --format json contract (REPORT_VERSION, §5) were never tested the way CI pipelines and agents actually consume them.

Adds surf-cli/tests/cli.rs (assert_cmd + predicates as dev-deps) covering the three things only the process boundary exercises:

Exit codes

JSON contract--format json parses from stdout and carries the versioned schema for check, lint, verify, and stats (asserts version == REPORT_VERSION and the expected keys per command).

Stream hygiene — stdout stays pure JSON even when a command also warns on stderr (zero-match --files glob), since the report is machine-consumed.

Verification

cargo test -p surf-cli --test cli → 10 passed. Full cargo test --all, cargo fmt --all --check, and cargo clippy --all-targets --all-features -- -D warnings all clean.

🤖 Generated with Claude Code

…act (#41)

Unit tests cover each command's logic and JSON shape in-process, but
nothing invoked the built `surf` binary the way CI pipelines and agents
do. Adds surf-cli/tests/cli.rs (assert_cmd + predicates) covering the
three things only the process boundary exercises:

- exit codes: clean check (0), diverged check (1), malformed-hub check
  (1, fails closed), blocking lint (1), and no-workspace (non-zero with
  a stderr message).
- `--format json` parses from stdout and matches the versioned schema
  (REPORT_VERSION) for check, lint, verify, and stats.
- stdout stays pure JSON when a command also warns on stderr (zero-match
  --files glob), since the report is machine-consumed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Connorrmcd6 Connorrmcd6 merged commit 0380850 into main Jun 13, 2026
5 checks passed
@Connorrmcd6 Connorrmcd6 deleted the test/41-binary-integration-tests branch June 13, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Binary-level integration tests: exit codes, human output, JSON contract

1 participant