Skip to content

test(sveltekit): Add SvelteKit 3 e2e app#21540

Draft
chargome wants to merge 4 commits into
developfrom
feat/sveltekit-3-e2e-app
Draft

test(sveltekit): Add SvelteKit 3 e2e app#21540
chargome wants to merge 4 commits into
developfrom
feat/sveltekit-3-e2e-app

Conversation

@chargome

@chargome chargome commented Jun 15, 2026

Copy link
Copy Markdown
Member

tbd

Add an e2e test application targeting the SvelteKit 3 prerelease so we can
verify @sentry/sveltekit against the next major as it develops. Deps float the
`next` dist-tag (kit, adapter-node, adapter-auto) on Svelte 5 / Vite 8 /
vite-plugin-svelte 7 / TypeScript 6 / Node 22.

The app is currently `sentryTest.skip`: SvelteKit 3 (Vite 8 / Rolldown) cannot
yet resolve `$env/*` virtual modules during build. This reproduces with the
Sentry plugin removed, so it is an upstream prerelease bug, not ours. Flip the
skip to optional/green once upstream ships a buildable prerelease.

Notable SvelteKit 3 change captured: `svelte.config.js` is removed - adapter and
preprocess config now go to the `sveltekit({ ... })` Vite plugin. The SDK's
Vite-plugin glue still reads `svelte.config.js` and will be adapted separately.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chargome chargome changed the title test(sveltekit): Add SvelteKit 3 e2e app (skipped, prerelease) test(sveltekit): Add SvelteKit 3 e2e app Jun 15, 2026
@chargome chargome self-assigned this Jun 15, 2026
chargome and others added 3 commits June 16, 2026 10:38
Turn on SvelteKit 3's native server-side tracing (`experimental.tracing.server`
and `experimental.instrumentation.server`) so the e2e app exercises the path
where @sentry/sveltekit picks up Kit's OpenTelemetry spans instead of starting
its own `http.server` span.

`Sentry.init` moves to `src/instrumentation.server.ts` (the native instrumentation
entry point); `hooks.server.ts` is reduced to `sequence(sentryHandle())` plus the
error handler. Swap the default-path performance/sdk tests for the native-tracing
`tracing.*` suites and add a `form-action` route to cover form-action spans,
mirroring `sveltekit-2-kit-tracing`. Config is passed via the `sveltekit()` Vite
plugin since SvelteKit 3 dropped `svelte.config.js`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…failing tests

Migrate the app to SvelteKit 3's explicit environment variables (`src/env.ts` +
`defineEnvVars`, imported from `$app/env/private`/`$app/env/public`). This is the
Kit 3 default and, unlike the legacy `$env/*` modules, builds under Vite 8 / Rolldown,
so the app now builds and runs (the app is no longer skipped wholesale).

The server DSN is declared `{ static: true }` (inlined at build): a dynamic private
var resolves to `undefined` at runtime under Kit 3's adapter-node even when present in
`process.env`.

Native OTel tracing works (init, span pickup, distributed traces pass: 9 passing). Five
server-side tests are skipped with `FIXME(sveltekit-3)` notes pending SDK adaptation:
- stack-frame function names are `load$1` and the request URL is `https` (the SDK still
  injects manual load instrumentation because it detects native tracing via the removed
  `svelte.config.js`);
- a duplicate server-load span (SDK span on top of Kit's native one), same root cause;
- the `POST /form-action` server transaction never arrives under Kit 3 (needs isolation).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant