11import { expect , test } from '@playwright/test' ;
22
33test . describe ( 'Spotlight environment variable handling' , ( ) => {
4- test ( 'respects NEXT_PUBLIC_SENTRY_SPOTLIGHT environment variable ' , async ( { page } ) => {
5- // This test assumes NEXT_PUBLIC_SENTRY_SPOTLIGHT=true is set in the env
4+ test ( 'NEXT_PUBLIC_SENTRY_SPOTLIGHT is accessible in browser ' , async ( { page } ) => {
5+ // NEXT_PUBLIC_SENTRY_SPOTLIGHT=true is set in next.config.js
66 await page . goto ( '/spotlight-env-test' ) ;
77
88 const nextPublicSpotlight = await page . getByTestId ( 'next-public-spotlight' ) . textContent ( ) ;
9- const spotlightStatus = await page . getByTestId ( 'spotlight-integration-found' ) . textContent ( ) ;
109
11- // Verify NEXT_PUBLIC_SENTRY_SPOTLIGHT is accessible in the browser
10+ // Verify NEXT_PUBLIC_SENTRY_SPOTLIGHT is accessible in the browser (embedded at build time)
1211 expect ( nextPublicSpotlight ) . toContain ( 'true' ) ;
13-
14- // Verify Spotlight integration is enabled
15- expect ( spotlightStatus ) . toContain ( 'ENABLED' ) ;
1612 } ) ;
1713
18- test ( 'NEXT_PUBLIC_SENTRY_SPOTLIGHT takes precedence over SENTRY_SPOTLIGHT ' , async ( { page } ) => {
14+ test ( 'SENTRY_SPOTLIGHT (server-only) is NOT accessible in browser ' , async ( { page } ) => {
1915 // This test verifies that even if SENTRY_SPOTLIGHT is set (e.g., for backend),
20- // NEXT_PUBLIC_SENTRY_SPOTLIGHT is what the browser sees
16+ // it's NOT exposed to the browser - only NEXT_PUBLIC_* vars are exposed
2117 await page . goto ( '/spotlight-env-test' ) ;
2218
2319 const sentrySpotlight = await page . getByTestId ( 'sentry-spotlight' ) . textContent ( ) ;
@@ -26,20 +22,8 @@ test.describe('Spotlight environment variable handling', () => {
2622 expect ( sentrySpotlight ) . toContain ( 'undefined' ) ;
2723 } ) ;
2824
29- test ( 'handles empty string environment variables correctly' , async ( { page } ) => {
30- // This test would need to be run with NEXT_PUBLIC_SENTRY_SPOTLIGHT=''
31- // It verifies that empty strings are treated as undefined and don't enable Spotlight
32-
33- // Note: This test would need a separate test run with different env vars
34- // For now, we document the expected behavior
35- await page . goto ( '/spotlight-env-test' ) ;
36-
37- // With an empty string, Spotlight should be disabled
38- // The resolveSpotlightOptions function filters out empty strings
39- } ) ;
40-
41- test ( 'process.env check works without errors in CJS build' , async ( { page } ) => {
42- // This test verifies that the CJS build (used by Next.js) doesn't have
25+ test ( 'no import.meta syntax errors in Next.js bundle' , async ( { page } ) => {
26+ // This test verifies that the CJS build (used by Next.js webpack) doesn't have
4327 // import.meta syntax which would cause parse errors
4428
4529 const consoleErrors : string [ ] = [ ] ;
0 commit comments