Skip to content

ref(cli): Drop the getters from the wizard's clack wrapper - #2658

Merged
BYK merged 1 commit into
mainfrom
antonis/wizard-clack-no-getters
Dec 1, 2026
Merged

BYK merged 1 commit into
mainfrom
antonis/wizard-clack-no-getters

Conversation

@antonis

@antonis antonis commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2652, from this review thread.

The wizard's clack object (utils/clack/prompts.ts) had a getter per member, so that the tests ported from sentry-wizard, which mock @clack/prompts with only the functions they use, still load the module: Vitest throws when code reads an export the mock doesn't define. Making the members plain properties breaks 58 of the 123 wizard test files at load.

Key Changes

  • clack spreads the @clack/prompts namespace instead. A spread copies only the exports a mock defines, so those tests still load. The import needs a sentry-cli/no-namespace-import exception, with its reason on the line.
  • withRequiredInput takes the prompt's name (confirm, multiselect, select, text) and looks up clack's function when called. Tests that spy on select after the module loads (configure-sentry-cli, fastfile) still see the calls.
  • cocoapod.test.ts spied on @clack/prompts' spinner after load, which the spread had already copied. It now spies on the wizard's clack.spinner, and drops its own namespace import and that import's lint exception.

Verification

  • Wizard unit tests pass, apart from 4 that fail the same way locally on main (wizard.test.ts argument parsing, xcode-manager.test.ts). CLI typecheck and pnpm run lint pass.
  • The npm bundle's wizard smoke tests (fix(cli): Bundle simple-plist's requires so the Apple and RN wizards start #2603) pass. With the built package, sentry wizard android < /dev/null still stops with exit code 1 and the message from fix(cli): Stop the wizard with exit code 1 when it has no terminal #2652, and one piped answer followed by the end of input is accepted.
  • The chunk with the wizard's clack code is slightly smaller (31,891 bytes, from 32,077); the bundle's total size is unchanged.
  • Not run locally: the wizard e2e suite and an interactive terminal session. CI's Wizard E2E runs the Next.js wizards, answering their prompts through a pipe.

🤖 Generated with Claude Code

Build `clack` by spreading `@clack/prompts` instead of a getter per
member. A spread copies only the exports a test's mock defines, so the
ported tests that mock clack partially still load the module. The
question prompts look up their clack function by name when called, so
`withRequiredInput` still wraps them and tests that spy on them still
see the calls. `cocoapod.test.ts` now spies on the wizard's
`clack.spinner`, which the spread copies at load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 1, 2026 12:58pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 1, 2026 12:58pm UTC

Request Review

@BYK
BYK marked this pull request as ready for review December 1, 2026 13:24
@BYK
BYK added this pull request to the merge queue Dec 1, 2026
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 1, 2026
Merged via the queue into main with commit 17880dc Dec 1, 2026
32 checks passed
@BYK
BYK deleted the antonis/wizard-clack-no-getters branch December 1, 2026 13:27

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 2a8a16c1 Deployed Dec 1, 2026 by vercel[bot]
Preview – sentry-local — 2a8a16c1 Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants