Skip to content

Refactor agent CLI tests to eliminate real subprocess calls#328

Merged
clcollins merged 1 commit into
mainfrom
srepd/refactor-agent-cli-tests
Jun 11, 2026
Merged

Refactor agent CLI tests to eliminate real subprocess calls#328
clcollins merged 1 commit into
mainfrom
srepd/refactor-agent-cli-tests

Conversation

@clcollins

Copy link
Copy Markdown
Owner

Summary

  • Introduces CommandExecutor interface to abstract exec.CommandContext in agentQuery, enabling dependency injection for tests
  • Refactors 7 tests (CommandParsing, MultiWordCommand, CommandNotFound, StderrCaptured, PassesEnvVars, PipesStdin, EmptyCommand) to use a mockCommandExecutor — zero subprocess calls, fully self-contained

Test plan

  • make test-all passes locally (fmt-check, vet, lint, test, test-race, test-fixtures)
  • make plan-check passes
  • make readme-check passes
  • CI passes on PR

Closes #318

💘 Generated with Crush

Introduces CommandExecutor interface to abstract exec.CommandContext,
allowing tests to inject a mock instead of spawning echo/cat/sh.
All 7 affected tests now verify behavior via mock fields with zero
subprocess calls.

Closes #318

💘 Generated with Crush

Assisted-by: Crush:claude-opus-4-6
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 35.71429% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.50%. Comparing base (4e7d42c) to head (7f86ef1).

Files with missing lines Patch % Lines
pkg/tui/claude.go 33.33% 8 Missing ⚠️
pkg/tui/model.go 50.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (35.71%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #328      +/-   ##
==========================================
- Coverage   67.60%   67.50%   -0.10%     
==========================================
  Files          49       49              
  Lines        7568     7573       +5     
==========================================
- Hits         5116     5112       -4     
- Misses       2110     2119       +9     
  Partials      342      342              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@clcollins clcollins merged commit f128448 into main Jun 11, 2026
10 checks passed
@clcollins clcollins deleted the srepd/refactor-agent-cli-tests branch June 11, 2026 00:31
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.

Refactor agent CLI tests to eliminate real subprocess calls

2 participants