Skip to content

test(cli): end-to-end pipe smoke test with real git fixtures - #45

Merged
axisrow merged 6 commits into
mainfrom
cli-smoke-test
Sep 29, 2026
Merged

axisrow merged 6 commits into
mainfrom
cli-smoke-test

Conversation

@axisrow

@axisrow axisrow commented Sep 29, 2026

Copy link
Copy Markdown
Owner

End-to-end smoke test for the piped-mode CLI: spawns the real src/ccstatusline.ts as 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 git rendered outside a repository
  • ↑1 / ↓1 rendered for a diverged branch (bare origin + clone + local commit + remote commit + fetch)
  • zero state hidden on a synced branch (no ↑0↓0)
  • (no upstream) rendered without an upstream

How it works

  • Minimal fixed settings.json (version 4, three git widgets) via --config — does not depend on the developer's live config or the default widget set
  • Temp HOME isolates the on-disk git cache (~/.cache/ccstatusline/git-cache/)
  • The fixture repo is selected via the payload cwd field (resolveGitCwd), so no process-cwd games
  • Runs outside the test process like custom-command-process.test.ts, because other suites mock child_process globally under Bun

Verification

🤖 Generated with Claude Code

tough-griff and others added 6 commits September 23, 2026 12:54
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>
@axisrow
axisrow merged commit 85ab37b into main Sep 29, 2026
6 checks passed
@axisrow
axisrow deleted the cli-smoke-test branch September 29, 2026 04:41
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.

2 participants