test(cli): end-to-end pipe smoke test with real git fixtures - #45
Merged
Merged
Conversation
Session, Weekly, Weekly Sonnet, Weekly Opus and Weekly Fable usage widgets, plus the Block and Weekly reset timers, gain an opt-in `zero` hideable state. Usage widgets hide when their raw usage is 0 (independent of invert); reset timers hide when their period's usage (session/weekly) is 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion Both widgets gain the opt-in `zero` hideable state: Used hides at $0 spent, Utilization hides at 0% (independent of invert). Extra Usage Remaining is left alone, since hiding it would hide either the full budget or the $0-left warning. The v3 -> v4 hide migration rule for the two widgets now lists `zero` so a hand-written hide list keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
List the new `zero` state for the usage-percent widgets, the reset timers, and Extra Usage Used/Utilization (noting Remaining has none). The shared suite's "zero state off" case now asserts the exact 0.0% output instead of just non-null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… time A null API bucket pins session/weekly usage to 0% even when limits[] still reports a live window (sirmalloc#503), so hide-when-zero was hiding reset timers that had a valid countdown. The timers now hide on zero only when no reset time was reported for that period, which still covers unused windows and Enterprise accounts with no rate-limit windows (sirmalloc#343). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spawn the real CLI in piped mode (bun src/ccstatusline.ts --config <tmp>) against real git fixture repos and assert on stdout: no-git outside a repository, ahead/behind counts for a diverged branch, hidden zero state on a synced branch, and the no-upstream state. The suite uses a temp HOME (isolates the on-disk git cache), a minimal fixed settings.json (does not depend on the developer's live config or the default widget set), and points git at the fixture via the payload cwd field. Runs outside the test process like custom-command-process, since other suites mock child_process globally under Bun. Co-Authored-By: Claude Code <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.
End-to-end smoke test for the piped-mode CLI: spawns the real
src/ccstatusline.tsas a subprocess against real git fixture repos and asserts on stdout, covering the "widget silently vanished from the render" regression class that unit tests can't see.What it covers
no gitrendered outside a repository↑1/↓1rendered for a diverged branch (bare origin + clone + local commit + remote commit + fetch)↑0↓0)(no upstream)rendered without an upstreamHow it works
settings.json(version 4, three git widgets) via--config— does not depend on the developer's live config or the default widget setHOMEisolates the on-disk git cache (~/.cache/ccstatusline/git-cache/)cwdfield (resolveGitCwd), so no process-cwd gamescustom-command-process.test.ts, because other suites mockchild_processglobally under BunVerification
bun test src/__tests__/cli-smoke.test.ts— 4 passbun test— 2625 pass, 0 fail (includes the merged feat(usage): add hide-when-zero state to usage widgets and reset timers sirmalloc/ccstatusline#599)bun run lintclean🤖 Generated with Claude Code