test(sveltekit): Add SvelteKit 3 e2e app#21540
Draft
chargome wants to merge 4 commits into
Draft
Conversation
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>
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>
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.
tbd