Skip to content

test(nextjs): Add sourcemaps test for nextjs turbopack #19657

Description

@github-actions

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-sourcemaps e2e test app that verifies sourcemaps uploads during next 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

  1. pnpm build starts a mock Sentry server on :3032, then runs next build with @sentry/nextjs configured to upload sourcemaps to it
  2. The mock server captures all requests (chunk uploads, artifact bundle assemble, releases) and writes them to disk
  3. pnpm test:assert runs assert-build.ts which loads the captured data and runs the assertion suite

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions