Skip to content

Commit 64c4692

Browse files
committed
works now?
1 parent d556863 commit 64c4692

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

dev-packages/e2e-tests/run.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ async function run(): Promise<void> {
7575
PUBLIC_E2E_TEST_DSN: dsn,
7676
REACT_APP_E2E_TEST_DSN: dsn,
7777
VITE_E2E_TEST_DSN: dsn,
78+
VITE_SENTRY_SPOTLIGHT: 'true',
7879
E2E_TEST_SENTRY_ORG_SLUG: process.env.E2E_TEST_SENTRY_ORG_SLUG || DEFAULT_SENTRY_ORG_SLUG,
7980
E2E_TEST_SENTRY_PROJECT: process.env.E2E_TEST_SENTRY_PROJECT || DEFAULT_SENTRY_PROJECT,
8081
};

dev-packages/e2e-tests/test-applications/SPOTLIGHT_ENV_TESTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ VITE_SENTRY_SPOTLIGHT=true pnpm test tests/spotlight-env.test.ts
173173
### Vite (ESM)
174174

175175
-`import.meta.env.VITE_SENTRY_SPOTLIGHT` accessible
176-
-`process.env.VITE_SENTRY_SPOTLIGHT` accessible (transformed)
176+
-`process.env.VITE_SENTRY_SPOTLIGHT` NOT accessible (Vite only exposes import.meta.env)
177177
-`import.meta` syntax present in output
178178
- ✅ No syntax errors
179179
- ✅ Spotlight integration enabled

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ test.describe('Spotlight environment variable handling in Vite (ESM)', () => {
3434
expect(importMetaValue).toContain('true');
3535
});
3636

37-
test('process.env also works via Vite transformation', async ({ page }) => {
38-
// Vite transforms process.env references at build time
37+
test('process.env is NOT available in Vite (only import.meta.env)', async ({ page }) => {
38+
// Vite does NOT transform process.env - only import.meta.env is available
3939
await page.goto('/spotlight-env-test.html');
4040

4141
await page.waitForTimeout(1000);
4242

4343
const processEnvValue = await page.getByTestId('process-env-spotlight').textContent();
4444

45-
// Verify process.env works (transformed by Vite)
46-
expect(processEnvValue).toContain('true');
45+
// Verify process.env is NOT available in Vite (this is expected behavior)
46+
// Unlike webpack/Next.js, Vite only exposes import.meta.env
47+
expect(processEnvValue).toContain('undefined');
4748
});
4849

4950
test('handles empty string environment variables correctly', async ({ page }) => {

0 commit comments

Comments
 (0)