Skip to content

Commit 7375247

Browse files
chargomeclaude
andcommitted
test(e2e): Run DB driver tests against the dev server for the remaining frameworks
Remix, Solid Start and TanStack Start only exercised orchestrion instrumentation against their production servers. Add a `TEST_ENV=development` pass over their DB tests so the runtime-hook path is covered too, the way astro-7, sveltekit-2 and react-router-7 already are. Solid Start and TanStack Start had no `dev` script, and neither dev server has build output to `--import`, so they load the SDK from the app's own instrumentation file instead. Solid Start needs a JS counterpart of its TypeScript init file for that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWyZ1Vgti4W8q8sEuJsfEY
1 parent a4762fe commit 7375247

8 files changed

Lines changed: 45 additions & 9 deletions

File tree

‎dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"test:build": "pnpm install && pnpm build",
1212
"test:assert": "pnpm playwright test",
1313
"test:build:orchestrion": "INJECT_ORCHESTRION=true pnpm test:build",
14-
"test:assert:orchestrion": "INJECT_ORCHESTRION=true pnpm test:assert"
14+
"test:assert:orchestrion": "INJECT_ORCHESTRION=true pnpm test:assert && INJECT_ORCHESTRION=true TEST_ENV=development pnpm playwright test db"
1515
},
1616
"dependencies": {
1717
"@sentry/remix": "file:../../packed/sentry-remix-packed.tgz",

‎dev-packages/e2e-tests/test-applications/create-remix-app-v2/playwright.config.mjs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ import { fileURLToPath } from 'url';
33

44
const injectOrchestrion = process.env.INJECT_ORCHESTRION === 'true';
55

6+
// `remix vite:dev` ignores PORT, so the port goes on the command. The dev server has no
7+
// bundle, so the SDK is loaded through `--import` the way `pnpm start` does it.
8+
const startCommand =
9+
process.env.TEST_ENV === 'development'
10+
? `NODE_OPTIONS='--import=./instrument.server.cjs' pnpm dev --port 3030`
11+
: `pnpm start`;
12+
613
const config = getPlaywrightConfig(
714
{
8-
startCommand: `pnpm start`,
15+
startCommand,
916
},
1017
// The orchestrion variant exercises real MySQL/Redis. Boot them before the tests run,
1118
// outside the webServer startup-timeout window. In the default variant no DB is needed.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Dev-server counterpart of `src/instrument.server.ts`. `vinxi dev` produces no build output, so
2+
// there is no `.output/server/instrument.server.mjs` to `--import`; this file is loaded directly.
3+
import * as Sentry from '@sentry/solidstart';
4+
5+
Sentry.init({
6+
traceLifecycle: 'static',
7+
dsn: process.env.E2E_TEST_DSN,
8+
environment: 'qa', // dynamic sampling bias to keep transactions
9+
tracesSampleRate: 1.0, // Capture 100% of the transactions
10+
tunnel: 'http://localhost:3031/', // proxy server
11+
debug: !!process.env.DEBUG,
12+
});

‎dev-packages/e2e-tests/test-applications/solidstart/package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"scripts": {
55
"clean": "pnpx rimraf node_modules pnpm-lock.yaml .vinxi .output",
66
"build": "vinxi build",
7+
"dev": "vinxi dev",
78
"preview": "HOST=localhost PORT=3030 vinxi start",
89
"start:import": "HOST=localhost PORT=3030 node --import ./.output/server/instrument.server.mjs .output/server/index.mjs",
910
"test:prod": "TEST_ENV=production playwright test",
1011
"test:build": "pnpm install && pnpm build",
11-
"test:assert": "pnpm test:prod"
12+
"test:assert": "pnpm test:prod && pnpm test:dev",
13+
"test:dev": "TEST_ENV=development playwright test db"
1214
},
1315
"type": "module",
1416
"dependencies": {

‎dev-packages/e2e-tests/test-applications/solidstart/playwright.config.mjs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { getPlaywrightConfig } from '@sentry-internal/test-utils';
22

3+
// `vinxi dev` ignores PORT, so the port goes on the command, and the SDK comes from the app's own
4+
// instrumentation file rather than the build output the production command uses.
5+
const startCommand =
6+
process.env.TEST_ENV === 'development'
7+
? `NODE_OPTIONS='--import ./instrument.server.mjs' pnpm dev --port 3030`
8+
: 'pnpm start:import';
9+
310
const config = getPlaywrightConfig({
4-
startCommand: 'pnpm start:import',
11+
startCommand,
512
port: 3030,
613
});
714

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"build": "vite build && cp instrument.server.mjs .output/server",
8+
"dev": "vite dev",
89
"start": "node --import ./.output/server/instrument.server.mjs .output/server/index.mjs",
910
"test": "playwright test",
1011
"clean": "npx rimraf node_modules pnpm-lock.yaml",
@@ -14,7 +15,7 @@
1415
"test:build:tunnel-custom": "pnpm install && E2E_TEST_CUSTOM_TUNNEL_ROUTE=1 pnpm build",
1516
"test:build:tunnel-object": "pnpm install && E2E_TEST_TUNNEL_ROUTE_MODE=object E2E_TEST_DSN=http://public@localhost:3031/1337 pnpm build",
1617
"test:build-latest": "pnpm add @tanstack/react-start@latest @tanstack/react-router@latest && pnpm install && pnpm build",
17-
"test:assert:proxy": "pnpm test",
18+
"test:assert:proxy": "pnpm test && TEST_ENV=development pnpm playwright test db-drivers",
1819
"test:assert": "pnpm test:assert:proxy",
1920
"test:assert:tunnel-generated": "E2E_TEST_TUNNEL_ROUTE_MODE=dynamic E2E_TEST_DSN=http://public@localhost:3031/1337 pnpm test",
2021
"test:assert:tunnel-streamed": "E2E_TEST_TUNNEL_ROUTE_MODE=dynamic E2E_TEST_DSN=http://public@localhost:3031/1337 E2E_TEST_STREAMED_SPANS=1 pnpm test",

‎dev-packages/e2e-tests/test-applications/tanstackstart-react/playwright.config.mjs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ import { getPlaywrightConfig } from '@sentry-internal/test-utils';
55
const usesManagedTunnelRoute =
66
(process.env.E2E_TEST_TUNNEL_ROUTE_MODE ?? 'off') !== 'off' || process.env.E2E_TEST_CUSTOM_TUNNEL_ROUTE === '1';
77

8+
// The dev server has no build output, so `--import` points at the app's own instrumentation file.
9+
// `vite dev` ignores PORT, so the port goes on the command.
10+
const startCommand =
11+
process.env.TEST_ENV === 'development'
12+
? `NODE_OPTIONS='--import ./instrument.server.mjs' pnpm dev --port 3000`
13+
: `pnpm start`;
14+
815
const config = getPlaywrightConfig({
9-
startCommand: `pnpm start`,
16+
startCommand,
1017
port: 3000,
1118
});
1219

‎dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/db-drivers.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const usesManagedTunnelRoute =
66

77
test.skip(usesManagedTunnelRoute, 'Default e2e suites run only in the proxy variant');
88

9-
// `sentryTanstackStart()` auto-wires the orchestrion build-time transform, which injects
10-
// `diagnostics_channel` publishers into these drivers as Vite bundles the server. That only
11-
// happens in the production build, which is what the e2e app runs.
9+
// Same spans in both runs, from two injectors: the orchestrion build-time transform that
10+
// `sentryTanstackStart()` auto-wires into the server bundle, and the runtime hook in `vite dev`,
11+
// where the drivers stay external on Node's own loader.
1212
test('Instruments ioredis automatically', async ({ baseURL }) => {
1313
const transactionEventPromise = waitForTransaction('tanstackstart-react', transactionEvent => {
1414
return (

0 commit comments

Comments
 (0)