Skip to content

Commit 90eca4e

Browse files
committed
fix(e2e): use development SDK exports for Spotlight env var tests
Configure Vite's resolve.conditions to use 'development' exports from @sentry/* packages. This includes the Spotlight auto-enablement code that reads VITE_SENTRY_SPOTLIGHT from environment variables. The SDK has conditional exports: - 'development': includes Spotlight auto-enablement - 'production': strips Spotlight code (default for builds)
1 parent a23d53a commit 90eca4e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
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-
93
Sentry.init({
104
dsn: import.meta.env.VITE_E2E_TEST_DSN,
115
debug: true,
126
tunnel: 'http://localhost:3031/',
137
tracesSampleRate: 1.0,
14-
// Explicitly enable Spotlight based on env var (since auto-enablement is dev-only)
15-
spotlight: shouldEnableSpotlight,
168
});
179

1810
// Check environment variables

dev-packages/e2e-tests/test-applications/browser-webworker-vite/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ export default defineConfig({
1313
},
1414
},
1515

16+
// Use development exports from @sentry/* packages to include Spotlight auto-enablement code
17+
// The SDK has conditional exports: "development" includes Spotlight, "production" strips it
18+
resolve: {
19+
conditions: ['development', 'module', 'browser', 'import'],
20+
},
21+
1622
plugins: [
1723
sentryVitePlugin({
1824
org: process.env.E2E_TEST_SENTRY_ORG_SLUG,

0 commit comments

Comments
 (0)