Skip to content

Commit 94d86a0

Browse files
committed
refactor(ci): Set NEXT_PUBLIC_SENTRY_SPOTLIGHT via real env var instead of next.config.js
This is more realistic - testing the actual env var flow that users would use. The env var is now conditionally set in CI only for test apps that contain 'spotlight' in their name.
1 parent b2716ec commit 94d86a0

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,10 @@ jobs:
991991
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
992992
working-directory: dev-packages/e2e-tests
993993

994+
- name: Set Spotlight env var for spotlight tests
995+
if: contains(matrix.test-application, 'spotlight')
996+
run: echo "NEXT_PUBLIC_SENTRY_SPOTLIGHT=true" >> $GITHUB_ENV
997+
994998
- name: Build E2E app
995999
working-directory: ${{ runner.temp }}/test-application
9961000
timeout-minutes: 7
@@ -1119,6 +1123,10 @@ jobs:
11191123
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
11201124
working-directory: dev-packages/e2e-tests
11211125

1126+
- name: Set Spotlight env var for spotlight tests
1127+
if: contains(matrix.test-application, 'spotlight')
1128+
run: echo "NEXT_PUBLIC_SENTRY_SPOTLIGHT=true" >> $GITHUB_ENV
1129+
11221130
- name: Build E2E app
11231131
working-directory: ${{ runner.temp }}/test-application
11241132
timeout-minutes: 7

dev-packages/e2e-tests/test-applications/nextjs-15-spotlight/next.config.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ const { withSentryConfig } = require('@sentry/nextjs');
22

33
/** @type {import('next').NextConfig} */
44
const nextConfig = {
5-
// Environment variables for Spotlight testing
6-
// NEXT_PUBLIC_* vars are embedded in the client bundle
7-
env: {
8-
NEXT_PUBLIC_SENTRY_SPOTLIGHT: 'true',
9-
},
5+
// NEXT_PUBLIC_SENTRY_SPOTLIGHT is set via environment variable in CI
6+
// The SDK reads it from process.env during withSentryConfig()
107
};
118

129
module.exports = withSentryConfig(nextConfig, {

0 commit comments

Comments
 (0)