Repository navigation
test(cli): run sentry wizard e2e tests in toolkit - #2547
sentry-junior[bot] wants to merge 17 commits into
Conversation
Start moving getsentry/sentry-wizard into the CLI as `sentry wizard`. This adds the command with the `@sentry/wizard` integrations and flags (`-i`, `--url`, `--org`, `--project`, `--saas`, `--spotlight`, and the rest), the shared wizard helpers, and the Next.js flow. The other integrations report that they are not available in this version yet. The wizard logs in with the CLI's own login: a stored `sentry auth login` session, an agent handoff, or the device flow, instead of the `account/settings/wizard/<hash>` browser flow. It then picks or creates the project, reads its DSN, and creates an org auth token for source map uploads. Telemetry goes through the CLI's client. `sentry init` stays the agent setup guide; its help now points to `sentry wizard` for the interactive setup. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Port `ast-utils` and `url` from getsentry/sentry-wizard into `src/lib/wizard/utils/`. The SvelteKit, Remix, React Router, Angular, Nuxt, source maps, Cloudflare, React Native and Android wizards all use them, so they land once here and the platform PRs that follow build on them in parallel. `ast-utils` edits recast ASTs, so recast and ast-types become direct dev dependencies; both already came in through magicast. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard` logs in with the CLI's login, which has no sign-up or partner step, so `--signup`, `--promo-code` and `--coming-from` no longer do anything. Passing one now fails with a message that points to https://sentry.io/signup/ instead of being accepted silently. `promoCode` and `comingFrom` leave `WizardOptions`, the welcome banner and `setupCI`, which loses its Vercel partner branch. The help text and the docs say which `@sentry/wizard` flags were removed. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…st-helpers Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
- Skip the `.sentryclirc` URL check, like `sentry init`: the wizard picks its instance (`--url`, `--saas` or a prompt) before it logs in. - Use the stored login's instance for `sentryUrl` when none was chosen, and log in again when the stored login is for another instance. - Link self-hosted users to `/settings/<org>/auth-tokens/`. - Leave an unparseable MCP config alone (show the copy-paste fallback), and let a cancel inside the MCP setup stop the wizard. - Resolve `catalog:` and `catalog:default` against both pnpm default catalog forms. - Find an existing `SENTRY_AUTH_TOKEN` after the comment header of `.env.sentry-build-plugin`, so re-runs don't add a second one. - Run Windows formatters with Node in the standalone binary, where `process.execPath` is `sentry`. - Ask before updating an `@sentry/nextjs` listed in devDependencies, and treat an unknown SDK version as the `^11` the wizard installs. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…st-helpers Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Address review feedback on the shared wizard helpers: - Enable unicorn/no-array-for-each repo-wide and convert every .forEach call site to for...of, including getLastRequireIndex. - Add buildProjectIssuesUrl to lib/sentry-urls.ts, built on getOrgBaseUrl like buildEventSearchUrl, and delete the wizard-specific wizard/utils/url.ts. - Move findFile into lib/dsn/fs-utils.ts and build it on isRegularFile, so a directory or FIFO with a matching name is skipped. It is async now. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard [<org>/<project>] [<integration>]` replaces the `@sentry/wizard` flags, with the target first like other commands. - The integration is a positional, one at a time. A bare integration id is never read as a target, and a single bare word is always read as an integration, so a project or org spelled like one is written `my-org/nextjs`, `nextjs/` or `/nextjs`. - The target parses with the CLI's org/project grammar and resolves after login with `resolveOrgOptionalTarget`, like other commands. Without one the org and project pickers run, with no detection. - `-f/--force` is the only flag. It sets both `forceInstall` and `ignoreGitChanges`. - The instance comes from `SENTRY_URL` or the stored login, so the SaaS/self-hosted prompt, `--url`, `--saas` and `skipRcUrlCheck` go. - Spotlight mode follows `SENTRY_SPOTLIGHT`, telemetry follows `isTelemetryEnabled()`, and debug output goes through the CLI logger (`--verbose`, `--log-level`). - Every other `@sentry/wizard` flag and `SENTRY_WIZARD_*` variable is gone, hidden ones included, with `disableTelemetryForRun` and `rejectRemovedFlags`. A test pins the wizard's own flags to `force`, and `check:env-coverage` (part of `ci:policy`) fails when any file under `src/` names `SENTRY_WIZARD_`. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Re-export buildProjectIssuesUrl from lib/sentry-web-urls.ts through withSentryBaseUrl(getApiBaseUrl()), like the other user-facing link builders, so self-hosted and regional logins get links on the host they are authenticated against. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Move the e2e harness, the help-message test, and the Next.js 14/15/16 tests and their test apps from getsentry/sentry-wizard's e2e-tests/ into packages/cli/test/wizard-e2e/, and run them against `sentry wizard`. The harness spawns the npm bundle (or SENTRY_CLI_BINARY) and answers clack prompts over stdin with a small builder shaped like the clifty API the upstream tests used, so the remaining platform tests port with few changes. Runs that need a project log in to a local mock Sentry API (the existing test/mocks routes plus org auth token creation) with --url, --org and --project, so no Sentry account or secret is needed. The help test snapshots the new help and checks that the removed sign-up flags fail. `pnpm run test:wizard-e2e` runs them. They install packages and build real apps, so they stay out of test:unit and test:e2e, and wizard-e2e.yml runs one job per test file on pull requests that touch the wizard or these tests, and on manual dispatch. Refs #2511
…eat/cli-wizard-e2e Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard` now takes `[<org>/<project>] [<integration>]` and only `-f/--force`, reads the instance from `SENTRY_URL`, and turns on Spotlight with `SENTRY_SPOTLIGHT`. The tests used the old flags. - Runs that need a project use `sentry wizard test-org/test-project nextjs`, with the mock API in `SENTRY_URL` and its token in `SENTRY_AUTH_TOKEN`. - The Spotlight run sets `SENTRY_SPOTLIGHT=1` through a new `env` option of `withEnv()`. - The help test snapshots the new help and checks that the sign-up flags and the other dropped `@sentry/wizard` flags fail. `--org` and `--project` still work as the CLI-wide hidden flags. - The tsconfig policy test lists the test apps as unchecked: they build with their own dependencies. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…eat/cli-wizard-shared-ast-helpers Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Warning Socket is a tool Sentry Security team deployed to defend against supply chain attack. Please provide any feedback you have in #discuss-security slack channel ❤️
|
…-wizard-e2e Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com> # Conflicts: # packages/cli/src/lib/wizard/utils/project-data.ts # packages/cli/test/lib/wizard/utils/project-data.test.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b1008cd. Configure here.
A wizard run happens in one `beforeAll`, and its step timeouts add up: the Next.js 16 run allows 5 minutes for the SDK install, 1 minute for the formatters and 1 minute to exit after the last output. The 6-minute hook timeout could cut a slow run short before any step timed out. Raise the hook and test timeouts to 15 minutes, inside the 20-minute CI job.

Ports sentry-wizard's end-to-end suite for help output and Next.js to
sentry wizard, becausesentry wizardreplaces@sentry/wizard. Part of #2511.Stacked on #2520.
The upstream fixture apps are vendored. A local mock API replaces Sentry, so no secrets are needed. The new
wizard-e2e.ymlworkflow is path-filtered and not required. A macOS job waits for the iOS/React Native port.via @BYK.
--
View Session [Sentry]