-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Note
The pull request "test(nextjs): Add sourcemaps test for nextjs turbopack" was created by @chargome but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.
This is just an early spike on how we can test uploaded sourcemaps, I'd like to expand this a bit further in follow up PRs for different Next.js scenarios
-
Adds a new
nextjs-sourcemapse2e test app that verifies sourcemaps uploads duringnext build -
The test app builds a minimal Next.js app against a mock Sentry server, then asserts that:
- Artifact bundles with valid manifests were uploaded
- JS/sourcemap pairs have matching, valid debug IDs (UUIDs)
- Sourcemaps contain real mappings and reference app source files
- Artifact bundle assemble requests target the correct project
-
Extracts the mock server and assertion logic into reusable utilities in
@sentry-internal/test-utils(startMockSentryServer,assertDebugIdPairs,assertSourcemapMappings, etc.) so other frameworks can reuse them.How it works
pnpm buildstarts a mock Sentry server on:3032, then runsnext buildwith@sentry/nextjsconfigured to upload sourcemaps to it- The mock server captures all requests (chunk uploads, artifact bundle assemble, releases) and writes them to disk
pnpm test:assertrunsassert-build.tswhich loads the captured data and runs the assertion suite