From cc8553e15f88a96e5601359d2fff33190f54d614 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Fri, 13 Nov 2026 07:54:11 +0100 Subject: [PATCH] test(nextjs): Run the source map upload e2e test on Bun Adds Bun variants for the Turbopack and the webpack build of `nextjs-sourcemaps`. They build with `bun --bun run build`, so Bun runs `next build` and the upload. The assert script checks the runtime in the User-Agent of the `sentry` CLI requests, so a variant fails when another runtime does the upload. Co-Authored-By: Claude Opus 5.5 --- .../nextjs-sourcemaps/assert-build.ts | 7 +++++++ .../nextjs-sourcemaps/package.json | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/assert-build.ts b/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/assert-build.ts index 5a89846b0a92..1f02a4bc61a2 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/assert-build.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/assert-build.ts @@ -9,6 +9,7 @@ import { getAssembleRequests, findSourceMapFiles, findSourceMappingUrlComments, + getRuntime, } from '@sentry-internal/test-utils'; const requests = loadMockServerResults(); @@ -31,6 +32,12 @@ assert.ok( 'Expected at least one chunk upload with a non-empty body', ); +// The `sentry` CLI adds the runtime that runs it to its User-Agent, for example `bun/1.4.2`. +const runtime = getRuntime(); +for (const req of chunkPosts) { + assert.match(req.requestHeaders['user-agent'] ?? '', new RegExp(` ${runtime}/`), `Expected ${runtime} to upload`); +} + // Release endpoint was called assert.ok( requests.some(r => r.url?.includes('/releases/')), diff --git a/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/package.json b/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/package.json index 5cfb7891c838..6eb21bda4d45 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-sourcemaps/package.json @@ -9,6 +9,8 @@ "test:assert": "pnpm ts-node --script-mode assert-build.ts", "test:build:delete": "pnpm install && E2E_DELETE_SOURCEMAPS=1 pnpm build", "test:build:delete-webpack": "pnpm install && E2E_DELETE_SOURCEMAPS=1 E2E_NEXT_WEBPACK=1 pnpm build", + "test:build:delete-bun": "pnpm install && E2E_DELETE_SOURCEMAPS=1 bun --bun run build", + "test:build:delete-webpack-bun": "pnpm install && E2E_DELETE_SOURCEMAPS=1 E2E_NEXT_WEBPACK=1 bun --bun run build", "test:assert:delete": "E2E_DELETE_SOURCEMAPS=1 pnpm test:assert" }, "dependencies": { @@ -37,6 +39,18 @@ "build-command": "pnpm test:build:delete-webpack", "assert-command": "pnpm test:assert:delete", "label": "nextjs-sourcemaps (delete, webpack)" + }, + { + "runtime": "bun", + "build-command": "pnpm test:build:delete-bun", + "assert-command": "pnpm test:assert:delete", + "label": "nextjs-sourcemaps (delete, turbopack, bun)" + }, + { + "runtime": "bun", + "build-command": "pnpm test:build:delete-webpack-bun", + "assert-command": "pnpm test:assert:delete", + "label": "nextjs-sourcemaps (delete, webpack, bun)" } ] }