Skip to content

Commit 1dfd682

Browse files
authored
test(e2e): Add more lighthouse react e2e test SDK init modes (#21711)
- `no-browser-api-errors`: errors-only but without this integration. Suspicion: patching all these event listeners creates overhead for react-based apps - `no-integrations`: init without default integration to check if just the client setup alone already causes significant overhead
1 parent 618d270 commit 1dfd682

4 files changed

Lines changed: 42 additions & 7 deletions

File tree

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
"[typescript]": {
3030
"editor.defaultFormatter": "oxc.oxc-vscode"
3131
},
32-
"oxc.suppressProgramErrors": true
32+
"oxc.suppressProgramErrors": true,
33+
"[typescriptreact]": {
34+
"editor.defaultFormatter": "oxc.oxc-vscode"
35+
}
3336
}

dev-packages/e2e-tests/test-applications/lighthouse-react/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"build:no-sentry": "vite build --mode no-sentry",
1111
"build:init-only": "vite build --mode init-only",
1212
"build:errors-only": "vite build --mode errors-only",
13+
"build:no-integrations": "vite build --mode no-integrations",
14+
"build:no-browser-api-errors": "vite build --mode no-browser-api-errors",
1315
"build:tracing": "vite build --mode tracing",
1416
"build:tracing-replay": "vite build --mode tracing-replay",
1517
"preview": "vite preview",

dev-packages/e2e-tests/test-applications/lighthouse-react/src/main.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ if (import.meta.env.MODE === 'tracing-replay') {
3333
release: 'lighthouse-fixture',
3434
environment: 'qa',
3535
});
36+
} else if (import.meta.env.MODE === 'no-integrations') {
37+
// DSN set but every integration disabled. Isolates the cost of the enabled
38+
// client itself from the default instrumentation that wraps DOM/timer/network APIs.
39+
Sentry.init({
40+
dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined,
41+
release: 'lighthouse-fixture',
42+
environment: 'qa',
43+
defaultIntegrations: false,
44+
integrations: [],
45+
});
46+
} else if (import.meta.env.MODE === 'no-browser-api-errors') {
47+
// Default integrations minus BrowserApiErrors, which wraps addEventListener/
48+
// removeEventListener on ~32 prototypes plus setTimeout/setInterval/rAF/XHR.
49+
// Isolates that global monkey-patching cost from the rest of the defaults.
50+
Sentry.init({
51+
dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined,
52+
release: 'lighthouse-fixture',
53+
environment: 'qa',
54+
integrations: defaultIntegrations =>
55+
defaultIntegrations.filter(integration => integration.name !== 'BrowserApiErrors'),
56+
});
3657
} else if (import.meta.env.MODE === 'init-only') {
3758
// enabled: false makes the SDK a guaranteed no-op (no transport allocation,
3859
// no DSN warning). We're measuring pure SDK-loading + tree-shaking cost.

scripts/lighthouse-bundle-and-upload.mjs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/**
22
* Bundle the `lighthouse-react` test app for each mode (no-sentry, init-only,
3-
* errors-only, tracing, tracing-replay) and POST the tarballs to the Sentry
4-
* Lighthouse lab (https://lighthouse.sentry.gg). The lab runs Lighthouse
5-
* asynchronously and ships results to Sentry on its own schedule — this script
6-
* exits as soon as the upload succeeds.
3+
* errors-only, no-integrations, no-browser-api-errors, tracing, tracing-replay)
4+
* and POST the tarballs to the Sentry Lighthouse lab
5+
* (https://lighthouse.sentry.gg). The lab runs Lighthouse asynchronously and
6+
* ships results to Sentry on its own schedule — this script exits as soon as
7+
* the upload succeeds.
78
*
8-
* Single-app static matrix: 1 app × 5 modes = 5 cells.
9+
* Single-app static matrix: 1 app × 7 modes = 7 cells.
910
*
1011
* Zero runtime dependencies — uses Node 22 builtins (fetch, FormData, Blob) and
1112
* the system `tar`. Every external command is invoked via `execFileSync` with
@@ -33,7 +34,15 @@ const E2E_DIR = path.join(WORKSPACE, 'dev-packages/e2e-tests');
3334

3435
const APP = 'lighthouse-react';
3536
const APP_DIR = 'lighthouse-react';
36-
const MODES = ['no-sentry', 'init-only', 'errors-only', 'tracing', 'tracing-replay'];
37+
const MODES = [
38+
'no-sentry',
39+
'init-only',
40+
'errors-only',
41+
'no-integrations',
42+
'no-browser-api-errors',
43+
'tracing',
44+
'tracing-replay',
45+
];
3746
const STATIC_DIR = 'dist';
3847

3948
async function run() {

0 commit comments

Comments
 (0)