Skip to content

test: adopt @doist/cli-core/testing shared helpers#6

Merged
scottlovegrove merged 1 commit into
mainfrom
scottl/test-helpers
May 25, 2026
Merged

test: adopt @doist/cli-core/testing shared helpers#6
scottlovegrove merged 1 commit into
mainfrom
scottl/test-helpers

Conversation

@scottlovegrove

Copy link
Copy Markdown
Collaborator

Summary

Ports the test-scaffolding dedupe from twist-cli into comms-cli. Goes straight to the published-helper end state (skipping the local-helper intermediate twist took).

Upstream PRs ported here:

Replaces per-file scaffolding with the published cli-core helpers (cli-core#49):

  • createTestProgram(register) collapses the 19 identical local createProgram() definitions to a one-line wrapper (call sites unchanged).
  • captureConsole(method?) replaces ~200 inline vi.spyOn(console, …).mockImplementation(() => {}) spies plus their manual mockRestore() calls — it auto-restores via onTestFinished.

Test-only change across 21 files; no runtime behaviour affected.

The channel-fixture dedupe from twist-cli#248 does not apply here — comms has no sampleChannel literal and only an accounts.ts fixture. No local src/test-helpers/ to delete (comms never created the intermediate).

Test plan

  • npm run type-check
  • npm run lint:check (oxlint + oxfmt) — 0 warnings/errors
  • npm test — 635 tests pass (37 files)

🤖 Generated with Claude Code

Replace per-file test scaffolding with the published cli-core helpers
(cli-core#49): createTestProgram(register) collapses the 19 identical
local createProgram() definitions to a one-line wrapper, and
captureConsole(method?) replaces ~200 inline vi.spyOn(console, ...)
spies plus their manual mockRestore() calls (it auto-restores via
onTestFinished).

Test-only change across 21 files; no runtime behaviour affected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@scottlovegrove scottlovegrove self-assigned this May 25, 2026
@doistbot doistbot requested a review from frankieyan May 25, 2026 09:37

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR cleanly adopts the @doist/cli-core/testing shared helpers to replace repetitive test scaffolding across the test suite. Consolidating the program creation and automating console spy cleanup significantly reduces boilerplate and improves the maintainability of the tests. No issues were flagged during the review, making this a solid improvement to the testing infrastructure!

Share FeedbackReview Logs

@scottlovegrove scottlovegrove added the 👀 Show PR PR must be reviewed before or after merging label May 25, 2026
@scottlovegrove scottlovegrove requested a review from amix May 25, 2026 09:44
@scottlovegrove scottlovegrove merged commit fae8923 into main May 25, 2026
6 checks passed
@scottlovegrove scottlovegrove deleted the scottl/test-helpers branch May 25, 2026 09:44

@amix amix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, great cleanup 💆‍♂️

@doist-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released 👀 Show PR PR must be reviewed before or after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants