test(cli/output): raise coverage from 0% to 82%#22
Merged
kevinelliott merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
internal/cli/output had no tests despite being the shared output layer for every CLI command. Adds focused unit tests for the three files: - colors_test.go: NoColor precedence (flag > NO_COLOR env > cfg), Printer routing (Success/Info/Print/Printf/Println to stdout; Warning/Error to stderr), no-color vs default Styles variants, and the Format* helpers (Status, Version, Badge, AgentName, Method, Header). - spinner_test.go: non-TTY Start/Stop are no-ops (no ANSI in buffer), Success/Error/Warning/Info icon rendering, NO_COLOR env propagation, double-stop safety, custom frames/interval options, and the isTerminal() helper against bytes.Buffer / io.Discard. - table_test.go: VisibleWidth (ASCII, empty, ANSI-stripped, multi-byte runes, mixed), Render (empty early-return, basic columns, ANSI headers don't bloat width, custom padding widens output, rows without headers). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds unit tests for internal/cli/output, the shared CLI output layer, to substantially increase statement coverage without changing production behavior.
Changes:
- Add tests for color/no-color resolution and
Printeroutput routing/style helpers. - Add tests for
Spinnernon-TTY behavior, variants, options, and terminal detection helper. - Add tests for
Tablerendering andVisibleWidth(ANSI stripping + rune width).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/cli/output/colors_test.go | Covers NoColor/Printer behaviors and Styles formatting helpers. |
| internal/cli/output/spinner_test.go | Covers non-TTY spinner semantics, icons, env propagation, options, and isTerminal(). |
| internal/cli/output/table_test.go | Covers VisibleWidth and core Table.Render output scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+54
to
+62
| // Column count: each non-empty line should contain both columns. | ||
| for _, line := range strings.Split(strings.TrimSpace(out), "\n") { | ||
| if line == "" { | ||
| continue | ||
| } | ||
| // Rough alignment sanity: the longest row (claude-code = 11 chars) | ||
| // should leave at least padding+1 spaces before the second column | ||
| // for shorter rows. | ||
| _ = line |
Comment on lines
+27
to
+31
| s.Start() | ||
| // Give the goroutine a chance to emit frames — there should be NONE | ||
| // because Start is a no-op on non-TTY output. | ||
| time.Sleep(30 * time.Millisecond) | ||
| s.Stop() |
kevinelliott
added a commit
that referenced
this pull request
Apr 21, 2026
Promote the Unreleased section to 1.2.0 and capture the UX / operability work landed since v1.1.0: - #20 install/update progress streaming with -v - #21 gRPC server wire-up in helper - #22, #26 test coverage (cli/output 0→82%, systray 0.2→3.2%) - #24 RefreshOnStart field removal - #27 bubbles v0.21 -> v1.0 - #28 go:embed baseline catalog (fresh `go install` works offline) - #29 pkg/logging slog wrapper wired into main and grpc recovery Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`internal/cli/output` had no tests despite being the shared output layer for every CLI command. This PR adds focused unit tests that bring the package to 82% statement coverage.
Coverage changes
Test files added
No production code changes.
Test plan
🤖 Generated with Claude Code