Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
6cb5513
feat(browser): Add environment variable support for Spotlight configu…
BYK Nov 13, 2025
f16380f
change priority order for SENTRY_SPOTLIGHT
BYK Nov 14, 2025
fda3d61
fixup changelog
BYK Nov 14, 2025
bcff50d
some more clean up
BYK Nov 14, 2025
cd42ebd
address issues raised by agents
BYK Nov 14, 2025
0ac2828
Fix test failure in CI (#18210)
BYK Nov 14, 2025
0915965
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Nov 14, 2025
6ea8d90
Process and resolve pull request comments (#18235)
BYK Nov 17, 2025
870be3b
Merge branch 'master' into feat/spotlight-environment-variable-support
BYK Nov 20, 2025
1cf7f7f
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 4, 2025
b6fda2b
some tests etc
BYK Dec 4, 2025
469940b
fix tests
BYK Dec 4, 2025
be6f1b5
add env2bool export back just in case
BYK Dec 4, 2025
c9b13e3
fix lint
BYK Dec 4, 2025
d129a79
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 4, 2025
f542f62
fix ts errors
BYK Dec 4, 2025
4c28587
fix prettier
BYK Dec 4, 2025
f9b555a
lint fixes
BYK Dec 4, 2025
e12b3fc
fix tests
BYK Dec 4, 2025
ab56171
fix prettification
BYK Dec 4, 2025
6cbd1fd
type error
BYK Dec 4, 2025
3bc5309
remove module field to fix webpack 4
BYK Dec 4, 2025
c78da67
remove unused ts-ignore
BYK Dec 5, 2025
fb3f764
fix maybe?
BYK Dec 5, 2025
d556863
fixes
BYK Dec 5, 2025
64c4692
works now?
BYK Dec 5, 2025
75f2b49
sigh
BYK Dec 5, 2025
9f1e28f
really?
BYK Dec 5, 2025
a23d53a
fix(e2e): explicitly pass spotlight env var to init in production builds
BYK Dec 5, 2025
90eca4e
fix(e2e): use development SDK exports for Spotlight env var tests
BYK Dec 5, 2025
f16915a
fix(e2e): use vite dev server for realistic Spotlight testing
BYK Dec 5, 2025
c7c9b95
feat(e2e): add Next.js Spotlight dev mode test application
BYK Dec 5, 2025
cb298e2
prettification
BYK Dec 5, 2025
5fdcf7d
fix(e2e): configure Next.js to use development export conditions
BYK Dec 5, 2025
c12edfc
feat(nextjs): auto-enable development export conditions in dev mode
BYK Dec 5, 2025
2ea8c45
fix(e2e): revert Vite app to use production build with dev SDK exports
BYK Dec 5, 2025
433c0ac
fix(e2e): update errors.test.ts to handle dev-mode filenames
BYK Dec 5, 2025
212a8bb
fix(nextjs): add conditionNames to WebpackConfigObject resolve type
BYK Dec 5, 2025
516ede0
fix(e2e): fix worker filename regex patterns
BYK Dec 5, 2025
5df223a
fix(nextjs): revert automatic development conditions
BYK Dec 5, 2025
102dc61
fix(nextjs): preserve existing conditionNames when adding development
BYK Dec 5, 2025
d4662e5
fix(nextjs): handle case where conditionNames doesn't exist
BYK Dec 5, 2025
7cffb67
fix(nextjs): add browser/node condition for client/server bundles
BYK Dec 5, 2025
dde88ca
fix(nextjs): use resolve.alias to point @sentry/browser to dev build
BYK Dec 5, 2025
9c6d19a
change approach
BYK Dec 5, 2025
de9943d
hmm
BYK Dec 5, 2025
f7d1ffd
again?
BYK Dec 8, 2025
3cf3a95
dot dot dot
BYK Dec 9, 2025
42d832c
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 9, 2025
4c6aaad
fallback
BYK Dec 9, 2025
d9d7124
prob not
BYK Dec 9, 2025
a313e1c
debugging
BYK Dec 9, 2025
77be213
bump nextjs size
BYK Dec 9, 2025
0d69896
lfg
BYK Dec 9, 2025
e32150d
turbopack...
BYK Dec 10, 2025
2346b4c
moare debug
BYK Dec 10, 2025
e549260
ok boss
BYK Dec 10, 2025
93eceb5
moar debug
BYK Dec 10, 2025
33df6a0
dddddebuggging
BYK Dec 10, 2025
669c71b
build fix
BYK Dec 10, 2025
8d639f4
...
BYK Dec 10, 2025
ca898d9
hmm
BYK Dec 10, 2025
855ff97
?
BYK Dec 10, 2025
5deeb64
yay!
BYK Dec 10, 2025
9ef14ff
simplifications
BYK Dec 10, 2025
fcab9df
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 11, 2025
693c80e
prettier fix
BYK Dec 11, 2025
7c1107f
fix(nextjs): Use valueInjectionLoader for Spotlight config instead of…
BYK Dec 11, 2025
9a9ba91
fix(browser): Remove development-only wrapper from Spotlight auto-ena…
BYK Dec 11, 2025
65860d4
fix(nextjs): Handle Spotlight auto-enablement in Next.js client SDK
BYK Dec 11, 2025
1ab6f28
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 11, 2025
7501e60
fix(ci): Add NEXT_PUBLIC_SENTRY_SPOTLIGHT env var for E2E tests
BYK Dec 11, 2025
351046b
fix(build): Revert rollup-utils changes that broke package builds
BYK Dec 11, 2025
eca64b5
fix(browser): Remove import.meta.env check to avoid CJS syntax errors
BYK Dec 11, 2025
0ad25a3
fix(nextjs): Honor explicit spotlight option even without env var
BYK Dec 11, 2025
b9d3337
fix(browser): Update build-artifacts tests to match actual env.ts imp…
BYK Dec 11, 2025
b2716ec
fix(ci): Remove global Spotlight env vars from E2E tests
BYK Dec 11, 2025
94d86a0
refactor(ci): Set NEXT_PUBLIC_SENTRY_SPOTLIGHT via real env var inste…
BYK Dec 11, 2025
43572cf
debug: Add logging to verify Spotlight env var is set in CI
BYK Dec 11, 2025
df539cf
debug: Add logging to show globalThis vs process.env in spotlight test
BYK Dec 11, 2025
c23f1d7
debug: Capture and print console logs in spotlight test
BYK Dec 12, 2025
e5409e6
debug: Log spotlight config detection in withSentryConfig
BYK Dec 12, 2025
bf2e634
fix(test-utils): Inherit environment variables in Playwright webServer
BYK Dec 12, 2025
b16f01d
fix(nextjs): Check process.env for Spotlight config as fallback
cursoragent Dec 12, 2025
40c4967
fix(nextjs): Inject _sentrySpotlight via globalThis for reliable Spot…
cursoragent Dec 12, 2025
1642e35
debug: Add logging to verify valueInjectionLoader in Spotlight test
cursoragent Dec 12, 2025
67d1d4b
chore: Fix formatting issues
cursoragent Dec 12, 2025
ce30f02
fix(nextjs): Update Spotlight test to explicitly pass spotlight option
cursoragent Dec 12, 2025
5bc01a0
fix(e2e): Explicitly disable Spotlight in react-router-7-lazy-routes …
cursoragent Dec 12, 2025
939e0cd
fix(e2e): Fix nextjs-15-spotlight test by using explicit spotlight pa…
cursoragent Dec 12, 2025
f24fa13
was it spotlight
BYK Dec 12, 2025
c7652fe
Revert "fix(e2e): Fix nextjs-15-spotlight test by using explicit spot…
BYK Dec 12, 2025
bb65b10
it wasn't spotlight
BYK Dec 12, 2025
d62b54e
fix(e2e): Remove global VITE_SENTRY_SPOTLIGHT from run.ts
BYK Dec 12, 2025
12481ec
fix(test-utils): Use epoch-based timestamps in event proxy server
BYK Dec 12, 2025
d873831
fix(test-utils): Use Date.now() only for cross-process timestamps
BYK Dec 12, 2025
4f2f69d
fix(test-utils): Use strict inequality for timestamp filter
BYK Dec 12, 2025
0a8c255
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 12, 2025
bae7fb6
fix(test-utils): Filter live events by listener registration time
BYK Dec 12, 2025
d72f2f2
fix(test-utils): Use server time for listener registration, not clien…
BYK Dec 12, 2025
87f6dc6
fix(test-utils): Use >= for live events, > only for buffered events
BYK Dec 12, 2025
f00a377
fix(test-utils): Prune old events from buffer when listener registers
BYK Dec 12, 2025
6465550
feat(test-utils): Add Spotlight support for E2E tests
BYK Dec 12, 2025
8d3702a
fix(test-utils): Fix buffer pruning to use strict < instead of <=
BYK Dec 12, 2025
1c05b4c
don't use shell:true
BYK Dec 12, 2025
130bd92
fix(test-utils): Fix TypeScript errors in spotlight.ts and event-prox…
BYK Dec 12, 2025
70435c7
fix(test-utils): Move @spotlightjs/spotlight to repo root devDependen…
BYK Dec 12, 2025
7d9e165
revert(test-utils): Revert all event-proxy-server.ts changes
BYK Dec 12, 2025
6e7eb39
fix yarn.lock and prettify
BYK Dec 12, 2025
ad6b021
revert: Revert Spotlight migration for react-router-7-lazy-routes
BYK Dec 12, 2025
03eb6e5
Merge branch 'develop' into feat/spotlight-environment-variable-support
BYK Dec 12, 2025
73ea2d6
feat(e2e): Migrate react-router-7-lazy-routes to use Spotlight correctly
BYK Dec 12, 2025
51262cf
dedupe and prettify
BYK Dec 12, 2025
fa8debc
fix(test-utils): Use npx to run Spotlight in test apps
BYK Dec 12, 2025
ee9ae35
fix(test-utils): Use spotlight from repo root and fix port detection
BYK Dec 12, 2025
4189085
fix(test-utils): Support both CJS and ESM for __dirname
BYK Dec 12, 2025
86cce1f
fix(test-utils): Fix lint errors in spotlight.ts
BYK Dec 12, 2025
76980e2
fix(test-utils): Wait for app to be ready before resolving startSpotl…
BYK Dec 12, 2025
1614dbb
fix(test-utils): Fix TypeScript error by capturing resolvedPort for c…
BYK Dec 12, 2025
7b8612c
fix(e2e): Use fixed port 8969 for Spotlight to match DSN
BYK Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .cursor/plans/migrate_e2e_to_spotlight_358ad839.plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
name: Migrate E2E to Spotlight
overview: Replace the custom event proxy server with Spotlight for E2E test event capture. This eliminates race conditions by using Spotlight's reliable event streaming instead of the fragile timestamp-based filtering in the current proxy.
todos:
- id: add-spotlight-dep
content: Add @spotlightjs/spotlight as devDependency to test-utils
status: completed
- id: create-spotlight-helpers
content: Create spotlight.ts with startSpotlight() and event waiting helpers
status: completed
- id: update-playwright-config
content: Add Spotlight support to getPlaywrightConfig()
status: completed
- id: migrate-first-app
content: Migrate react-router-7-lazy-routes as proof of concept
status: in_progress
- id: migrate-remaining
content: Migrate remaining ~106 test apps incrementally
status: pending
- id: cleanup-old-proxy
content: Remove deprecated event proxy code after full migration
status: pending
---

# Migrate E2E Tests from Event Proxy to Spotlight

## Current Architecture

```mermaid
flowchart LR
subgraph current [Current Setup]
App[Test App] -->|"tunnel: localhost:3031"| Proxy[Event Proxy Server]
Proxy -->|Buffer + Timestamp Filter| Buffer[(Event Buffer)]
Test[Playwright Test] -->|waitForTransaction| Buffer
end
```

**Problems with current approach:**

- Timestamp filtering has race conditions (stale events leak through)
- Complex buffer management with timing edge cases
- 108 test apps, ~162 files use `tunnel: localhost:3031`

## Proposed Architecture

```mermaid
flowchart LR
subgraph proposed [Spotlight Setup]
App2[Test App] -->|"DSN: spotlight@localhost:PORT/0"| Spotlight[Spotlight Sidecar]
Spotlight -->|JSON Stream| Stream[(stdout/stderr)]
Test2[Playwright Test] -->|waitForTransaction| Stream
end
```

**Benefits:**

- No timestamp filtering needed - Spotlight streams events in order
- Production-tested event handling
- Cleaner architecture with less custom code

## Implementation Plan

### Phase 1: Add Spotlight Infrastructure

1. **Add `@spotlightjs/spotlight` dependency** to [`dev-packages/test-utils/package.json`](dev-packages/test-utils/package.json)

2. **Create new Spotlight-based helpers** in [`dev-packages/test-utils/src/spotlight.ts`](dev-packages/test-utils/src/spotlight.ts):
- `startSpotlight(options)` - Spawns `spotlight run` with dynamic port, parses port from stderr
- `waitForSpotlightEvent(filter)` - Reads from Spotlight's JSON output stream
- `waitForTransaction()`, `waitForError()`, etc. - High-level wrappers matching current API

3. **Update [`dev-packages/test-utils/src/playwright-config.ts`](dev-packages/test-utils/src/playwright-config.ts)**:
- Add option to use Spotlight instead of event proxy
- Configure webServer to run Spotlight with dynamic port
- Pass port via environment variable to test app

### Phase 2: Create Migration Path

4. **Design backward-compatible API**:
- Keep existing `waitForTransaction()` signature
- New implementation reads from Spotlight instead of HTTP streaming
- Port is passed via `SPOTLIGHT_PORT` env var

5. **Update DSN handling in test apps**:
- Replace `tunnel: 'http://localhost:3031'` with DSN workaround
- DSN format: `http://spotlight@localhost:${SPOTLIGHT_PORT}/0`
- This makes SDK operate in "normal" mode (no tunnel)

### Phase 3: Migrate Test Apps (Incremental)

6. **Migration per test app involves**:
- Remove `start-event-proxy.mjs`
- Update `playwright.config.mjs` to use new Spotlight config
- Update Sentry init to use DSN workaround instead of tunnel
- No changes needed to test files (API stays the same)

7. **Start with problematic apps**:
- `react-router-7-lazy-routes` (the failing one)
- `react-router-7-framework`
- Then expand to remaining ~106 apps

### Phase 4: Cleanup

8. **After all apps migrated**:
- Remove old event proxy code from `event-proxy-server.ts`
- Update documentation
- Remove unused dependencies

## Key Technical Details

### Port Extraction from Spotlight

Spotlight outputs startup info to stderr. We parse it to get the dynamic port:

```
Spotlight listening on http://localhost:8969
```

### DSN Workaround Format

Per [Spotlight docs](https://spotlightjs.com/docs/cli/run/#unsupported-sdks-dsn-workaround):

```javascript
Sentry.init({
dsn: `http://spotlight@localhost:${process.env.SPOTLIGHT_PORT}/0`,
});
```

### Playwright Config Changes

```javascript
// Before
webServer: [
{ command: 'node start-event-proxy.mjs', port: 3031 },
{ command: 'yarn start', port: 3030 },
];

// After - spotlight run auto-detects and runs the app
webServer: [{ command: 'yarn spotlight run -p 0 -f json', port: 3030 }];
```

Note: `spotlight run` automatically:

- Detects the start script from package.json (`dev`, `develop`, `serve`, `start`)
- Starts the Spotlight sidecar on the specified port (or dynamic with `-p 0`)
- Streams events to stdout in JSON format (with `-f json`)
- Sets `SENTRY_SPOTLIGHT` env var for the child process
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Internal planning file accidentally committed to repository

The .cursor/plans/ directory contains internal planning documentation (a Cursor AI migration plan) that was accidentally committed to the repository. This file includes implementation todos and internal planning notes that likely shouldn't be part of the codebase.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Cursor AI planning file accidentally committed to repo

The .cursor/plans/ directory contains an internal Cursor AI development planning file that appears to have been accidentally committed. This file is not in .gitignore and contains internal development notes, TODO status tracking, and architecture diagrams that are typically local developer artifacts rather than production code.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Cursor planning file accidentally included in commit

A Cursor AI development planning file was committed to the repository. The .cursor/plans/ directory contains internal development notes and task tracking that shouldn't be in the codebase. This file should be removed and the .cursor directory should likely be added to .gitignore.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Plan file accidentally committed to repository

A Cursor IDE plan file (.cursor/plans/migrate_e2e_to_spotlight_358ad839.plan.md) was accidentally committed to the repository. This is a development artifact containing internal planning notes and TODO items that should not be part of the production codebase. The file includes task status markers and implementation notes specific to a developer's local workflow.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Accidentally committed Cursor plan file

The .cursor/plans/migrate_e2e_to_spotlight_358ad839.plan.md file appears to be a personal development planning document from the Cursor IDE. This file contains internal implementation notes and a to-do list that shouldn't be committed to the repository. It should likely be added to .gitignore or removed from this PR.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Development plan file accidentally committed to repository

A Cursor IDE development plan file was committed to the repository. This contains implementation notes and todos with statuses like "in_progress" and "pending" that are internal development artifacts. The .cursor/ directory should likely be in .gitignore to prevent IDE-generated files from being committed.

Fix in Cursor Fix in Web

14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,9 @@ jobs:
NEXT_PUBLIC_E2E_TEST_DSN: 'https://username@domain/123'
PUBLIC_E2E_TEST_DSN: 'https://username@domain/123'
REACT_APP_E2E_TEST_DSN: 'https://username@domain/123'
VITE_E2E_TEST_DSN: 'https://username@domain/123'
# Note: Spotlight env vars are NOT set globally - they should only be set
# in test apps that specifically test Spotlight functionality
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
strategy:
Expand Down Expand Up @@ -988,6 +991,10 @@ jobs:
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
working-directory: dev-packages/e2e-tests

- name: Set Spotlight env var for spotlight tests
if: contains(matrix.test-application, 'spotlight')
run: echo "NEXT_PUBLIC_SENTRY_SPOTLIGHT=true" >> $GITHUB_ENV

- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 7
Expand Down Expand Up @@ -1060,6 +1067,9 @@ jobs:
NEXT_PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
PUBLIC_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
REACT_APP_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
VITE_E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
# Note: Spotlight env vars are NOT set globally - they should only be set
# in test apps that specifically test Spotlight functionality
E2E_TEST_SENTRY_ORG_SLUG: 'sentry-javascript-sdks'
E2E_TEST_SENTRY_PROJECT: 'sentry-javascript-e2e-tests'
strategy:
Expand Down Expand Up @@ -1113,6 +1123,10 @@ jobs:
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
working-directory: dev-packages/e2e-tests

- name: Set Spotlight env var for spotlight tests
if: contains(matrix.test-application, 'spotlight')
run: echo "NEXT_PUBLIC_SENTRY_SPOTLIGHT=true" >> $GITHUB_ENV

- name: Build E2E app
working-directory: ${{ runner.temp }}/test-application
timeout-minutes: 7
Expand Down
2 changes: 1 addition & 1 deletion .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ module.exports = [
import: createImport('init'),
ignore: ['next/router', 'next/constants'],
gzip: true,
limit: '46 KB',
limit: '47 KB',
},
// SvelteKit SDK (ESM)
{
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Unreleased

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
- feat(browser): Add environment variable support for Spotlight configuration ([#18198](https://github.com/getsentry/sentry-javascript/pull/18198))
- `SENTRY_SPOTLIGHT`, `PUBLIC_SENTRY_SPOTLIGHT`, `NEXT_PUBLIC_SENTRY_SPOTLIGHT`, `VITE_SENTRY_SPOTLIGHT`, `NUXT_PUBLIC_SENTRY_SPOTLIGHT`, `REACT_APP_SENTRY_SPOTLIGHT`, `VUE_APP_SENTRY_SPOTLIGHT`, and `GATSBY_SENTRY_SPOTLIGHT`

Work in this release was contributed by @sebws. Thank you for your contribution!

Expand Down
66 changes: 66 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,72 @@ the tests in each location. Check out the `scripts` entry of the corresponding `

Note: you must run `yarn build` before `yarn test` will work.

## Running E2E Tests Locally

The E2E tests in `dev-packages/e2e-tests/test-applications/` use Playwright and pnpm. To run them locally:

### Prerequisites

1. **Enable pnpm support in Volta** (required for E2E tests):

```bash
export VOLTA_FEATURE_PNPM=1
```

Add this to your shell profile (`.bashrc`, `.zshrc`, etc.) for persistence.

2. **Build the SDK packages** you want to test:

```bash
yarn build:dev:filter @sentry/nextjs # or whichever package you're testing
```

### Running a specific E2E test app

1. Navigate to the test application directory:

```bash
cd dev-packages/e2e-tests/test-applications/<app-name>
```

2. Install dependencies:

```bash
pnpm install
```

3. Link local SDK packages (to test your changes instead of the published version):

```bash
# Remove existing @sentry packages and create symlinks to local builds
rm -rf node_modules/@sentry
mkdir -p node_modules/@sentry
ln -sf ../../../../../../../../packages/nextjs node_modules/@sentry/nextjs
ln -sf ../../../../../../../../packages/core node_modules/@sentry/core
ln -sf ../../../../../../../../packages/browser node_modules/@sentry/browser
ln -sf ../../../../../../../../packages/react node_modules/@sentry/react
# Add other packages as needed for your test
```

4. Install Playwright browsers (first time only):

```bash
npx playwright install chromium
```

5. Run the tests:

```bash
npx playwright test
```

### Troubleshooting

- **WSL2 Chromium issues**: If you encounter "Invalid file descriptor to ICU data" or segfaults, you may need a newer
Playwright version. The test apps use `@playwright/test: ~1.56.0` which works in WSL2.
- **Stale builds**: After making SDK changes, rebuild with `yarn build:dev:filter @sentry/<package>` and re-link.
- **Port conflicts**: Check if the test app's port (usually 3030) is available.

## Debug Build Flags

Throughout the codebase, you will find a `__DEBUG_BUILD__` constant. This flag serves two purposes:
Expand Down
1 change: 1 addition & 0 deletions dev-packages/e2e-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ tmp
.tmp_build_stderr
pnpm-lock.yaml
.last-run.json
.next
3 changes: 3 additions & 0 deletions dev-packages/e2e-tests/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ async function run(): Promise<void> {
NEXT_PUBLIC_E2E_TEST_DSN: dsn,
PUBLIC_E2E_TEST_DSN: dsn,
REACT_APP_E2E_TEST_DSN: dsn,
VITE_E2E_TEST_DSN: dsn,
// Note: Spotlight env vars (VITE_SENTRY_SPOTLIGHT, etc.) are NOT set globally.
// They should only be set in test apps that specifically test Spotlight functionality.
E2E_TEST_SENTRY_ORG_SLUG: process.env.E2E_TEST_SENTRY_ORG_SLUG || DEFAULT_SENTRY_ORG_SLUG,
E2E_TEST_SENTRY_PROJECT: process.env.E2E_TEST_SENTRY_PROJECT || DEFAULT_SENTRY_PROJECT,
// Pass workspace root so tests copied to temp dirs can find local packages
Expand Down
20 changes: 10 additions & 10 deletions dev-packages/e2e-tests/test-applications/angular-17/src/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular17</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
<head>
<meta charset="utf-8" />
<title>Angular17</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<app-root></app-root>
</body>
</html>
20 changes: 10 additions & 10 deletions dev-packages/e2e-tests/test-applications/angular-18/src/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular 18</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
<head>
<meta charset="utf-8" />
<title>Angular 18</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<app-root></app-root>
</body>
</html>
20 changes: 10 additions & 10 deletions dev-packages/e2e-tests/test-applications/angular-19/src/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular19</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
<head>
<meta charset="utf-8" />
<title>Angular19</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<app-root></app-root>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --port 3030",
"build": "rm -rf dist && tsc && vite build",
"preview": "vite preview --port 3030",
"test": "playwright test",
"test:build": "pnpm install && pnpm build",
"test:build": "pnpm install",
"test:assert": "pnpm test"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getPlaywrightConfig } from '@sentry-internal/test-utils';

const config = getPlaywrightConfig({
startCommand: `pnpm preview`,
// Use vite dev server to test development-mode behavior (e.g., Spotlight auto-enablement)
startCommand: `pnpm dev`,
eventProxyFile: 'start-event-proxy.mjs',
eventProxyPort: 3031,
port: 3030,
Expand Down
Loading
Loading