test: adopt @doist/cli-core/testing shared helpers#78
Merged
Conversation
Replace bespoke inline test scaffolding with the published @doist/cli-core/testing helpers, mirroring todoist-cli#361 (cli-core#49): - createTestProgram(register) replaces inline `new Command(); exitOverride(); registerX(program)` harness blocks. - captureConsole(method?) replaces inline `vi.spyOn(console, …)` recorders and the local captureLogs/captureStreams helpers; assertions read the spy's .mock.calls via a small lines() accessor. Bump @doist/cli-core 0.23.0 -> 0.24.0, which ships these helpers. No source/runtime files changed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
doistbot
reviewed
May 24, 2026
Member
doistbot
left a comment
There was a problem hiding this comment.
This PR does a great job standardizing the test suite by replacing custom scaffolding with the shared @doist/cli-core/testing helpers like createTestProgram and captureConsole. These updates make the tests much cleaner and align the repository's patterns more closely with the rest of the CLI ecosystem. There is just a minor opportunity to further reduce repetition by lifting the duplicated lines() helper to the top level of the test file so it can be shared across all describe blocks and spy assertions.
Address review: dedupe the per-describe lines() helper into a single top-level function (matching auth-command.test.ts) and reuse it for the errorSpy assertions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 1.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
@doist/cli-core/testinghelpers, mirroring todoist-cli#361 (per cli-core#49).createTestProgram(register)replaces inlinenew Command(); exitOverride(); registerX(program)harness blocks acrosscommands,changelog-integration,empty-output, andauth-commandtests.captureConsole(method?)replaces inlinevi.spyOn(console, …)recorders and the localcaptureLogs/captureStreamshelpers; assertions now read the spy's.mock.callsvia a smalllines()accessor.@doist/cli-core0.23.0 → 0.24.0, which ships these helpers. No source/runtime files changed.Notes / deviations
captureStreamusage — outline-cli has noprocess.stdout/stderr.writespies (todoist adopted it viamockProcessStdout).buildTokenStore/account fixtures, same as todoist-cli — outline's auth tests are module-levelvi.mockinteraction mocks, the wrong shape for cli-core's stateful store fake.captureConsoletakes a single method string (captureConsole('error')), per the published 0.24.d.ts.Test plan
npm run type-checknpm run lint:check— 0 warnings, 0 errorsnpm run format:checknpm test— 188 tests pass (21 files)🤖 Generated with Claude Code