Test the interactive CLI in a pseudo-terminal #58

Open
opened 2026-11-13 13:42:50 +00:00 by chris-kreidl · 0 comments
chris-kreidl commented 2026-11-13 13:42:50 +00:00 (Migrated from github.com)

🤖 Claude: Tests run cli.ts in a pseudo-terminal, so the interactive menu, the resume prompt and Ctrl-C are covered, not only checked by hand.

From the M2 retro (#50). The Ctrl-C bug fixed in #55 (Ctrl-C during a progress bar never stopped the CLI) lived from #48 through all of M2, because no test sends a signal or drives the menu. In #15 I checked the menu hints and the resume prompt by hand, in a pseudo-terminal. Bun's Bun.spawn has a terminal option for this, so no new package is needed.

Acceptance criteria

Proposed. To be agreed in backlog refinement.

  • A test helper starts cli.ts in a pseudo-terminal against a temporary database and fixture data, with no network access (SEC and Yahoo faked), sends keystrokes, and reads the screen output.
  • Menu: the step menu shows each step's last-run hint from jobs, and choosing steps runs them in pipeline order.
  • Resume prompt: with an interrupted refresh in jobs, the CLI asks whether to resume or start over, and each answer does what it says.
  • Ctrl-C: Ctrl-C during a progress bar stops the CLI with a non-zero exit, and the next start finds the job interrupted.
  • The tests run in bun test and finish in a few seconds.

Definition of Done

  • Acceptance criteria met and demonstrated
  • bun test passes; new logic has tests
  • bun check is clean and bun fmt --check passes
  • Runs end to end on real data (not just fixtures)
  • Committed with Closes #<this issue>
🤖 **Claude:** Tests run `cli.ts` in a pseudo-terminal, so the interactive menu, the resume prompt and Ctrl-C are covered, not only checked by hand. From the M2 retro (#50). The Ctrl-C bug fixed in #55 (Ctrl-C during a progress bar never stopped the CLI) lived from #48 through all of M2, because no test sends a signal or drives the menu. In #15 I checked the menu hints and the resume prompt by hand, in a pseudo-terminal. Bun's `Bun.spawn` has a `terminal` option for this, so no new package is needed. ### Acceptance criteria *Proposed. To be agreed in backlog refinement.* - [ ] A test helper starts `cli.ts` in a pseudo-terminal against a temporary database and fixture data, with no network access (SEC and Yahoo faked), sends keystrokes, and reads the screen output. - [ ] **Menu:** the step menu shows each step's last-run hint from `jobs`, and choosing steps runs them in pipeline order. - [ ] **Resume prompt:** with an interrupted refresh in `jobs`, the CLI asks whether to resume or start over, and each answer does what it says. - [ ] **Ctrl-C:** Ctrl-C during a progress bar stops the CLI with a non-zero exit, and the next start finds the job `interrupted`. - [ ] The tests run in `bun test` and finish in a few seconds. ### Definition of Done - [ ] Acceptance criteria met and demonstrated - [ ] `bun test` passes; new logic has tests - [ ] `bun check` is clean and `bun fmt --check` passes - [ ] Runs end to end on real data (not just fixtures) - [ ] Committed with `Closes #<this issue>`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ckreidl/screener#58
No description provided.