Skip to content

Commit a23d53a

Browse files
committed
fix(e2e): explicitly pass spotlight env var to init in production builds
In production builds, the automatic Spotlight enablement from env vars is stripped (by design). The test now explicitly reads VITE_SENTRY_SPOTLIGHT and passes it to Sentry.init({ spotlight: ... }) which is the recommended approach for production builds.
1 parent 9f1e28f commit a23d53a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dev-packages/e2e-tests/test-applications/browser-webworker-vite/src/spotlight-env-test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import * as Sentry from '@sentry/browser';
22

3+
// Read VITE_SENTRY_SPOTLIGHT from environment
4+
// In production builds, automatic Spotlight enablement is stripped,
5+
// so we explicitly pass the env var value to init()
6+
const spotlightEnvValue = import.meta.env.VITE_SENTRY_SPOTLIGHT;
7+
const shouldEnableSpotlight = spotlightEnvValue === 'true' || spotlightEnvValue === true;
8+
39
Sentry.init({
410
dsn: import.meta.env.VITE_E2E_TEST_DSN,
511
debug: true,
612
tunnel: 'http://localhost:3031/',
713
tracesSampleRate: 1.0,
14+
// Explicitly enable Spotlight based on env var (since auto-enablement is dev-only)
15+
spotlight: shouldEnableSpotlight,
816
});
917

1018
// Check environment variables

0 commit comments

Comments
 (0)