diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/package.json b/dev-packages/e2e-tests/test-applications/solidstart-2/package.json index 04c1fadeb65e..5fdafe207bda 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/package.json +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/package.json @@ -1,12 +1,12 @@ { "name": "solidstart-2", "version": "0.0.0", - "//": "In the build script, the instrument.server.ts file is copied to the .output/server dir. Ideally, this is done in the SDK.", + "//": "Sentry is initialized from server/plugins/sentry.ts, a Nitro plugin. Build-time instrumentation means there is no `--import` preload and nothing to copy into .output.", "scripts": { "clean": "pnpx rimraf node_modules pnpm-lock.yaml .nitro .output", - "build": "vite build && cp src/instrument.server.ts .output/server/instrument.server.mjs", + "build": "vite build", "preview": "HOST=localhost PORT=3030 vite preview", - "start:import": "HOST=localhost PORT=3030 node --import ./.output/server/instrument.server.mjs .output/server/index.mjs", + "start": "HOST=localhost PORT=3030 node .output/server/index.mjs", "test:prod": "TEST_ENV=production playwright test", "test:build": "pnpm install && pnpm build", "test:assert": "pnpm test:prod" @@ -21,7 +21,7 @@ "@sentry-internal/test-utils": "link:../../../test-utils", "@solidjs/meta": "^0.29.4", "@solidjs/router": "^1.0.0", - "@solidjs/start": "2.0.0-rc.6", + "@solidjs/start": "2.0.0", "@solidjs/testing-library": "^0.8.10", "@testing-library/jest-dom": "^6.4.2", "@testing-library/user-event": "^14.5.2", diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/solidstart-2/playwright.config.mjs index ee2ee42980b8..b52ff06a5105 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/playwright.config.mjs +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/playwright.config.mjs @@ -1,7 +1,7 @@ import { getPlaywrightConfig } from '@sentry-internal/test-utils'; const config = getPlaywrightConfig({ - startCommand: 'pnpm start:import', + startCommand: 'pnpm start', port: 3030, }); diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/server/plugins/sentry.ts b/dev-packages/e2e-tests/test-applications/solidstart-2/server/plugins/sentry.ts new file mode 100644 index 000000000000..afb4cc632949 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/server/plugins/sentry.ts @@ -0,0 +1,14 @@ +import * as Sentry from '@sentry/solidstart'; +import { definePlugin } from 'nitro'; + +// Runs once at server startup. Build-time instrumentation means no `--import` preload is needed. +export default definePlugin(() => { + Sentry.init({ + traceLifecycle: 'static', + dsn: process.env.E2E_TEST_DSN, + environment: 'qa', // dynamic sampling bias to keep transactions + tracesSampleRate: 1.0, // Capture 100% of the transactions + tunnel: 'http://localhost:3031/', // proxy server + debug: !!process.env.DEBUG, + }); +}); diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/src/instrument.server.ts b/dev-packages/e2e-tests/test-applications/solidstart-2/src/instrument.server.ts deleted file mode 100644 index d89f2566f8be..000000000000 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/src/instrument.server.ts +++ /dev/null @@ -1,10 +0,0 @@ -import * as Sentry from '@sentry/solidstart'; - -Sentry.init({ - traceLifecycle: 'static', - dsn: process.env.E2E_TEST_DSN, - environment: 'qa', // dynamic sampling bias to keep transactions - tracesSampleRate: 1.0, // Capture 100% of the transactions - tunnel: 'http://localhost:3031/', // proxy server - debug: !!process.env.DEBUG, -}); diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/tsconfig.json b/dev-packages/e2e-tests/test-applications/solidstart-2/tsconfig.json index 950c6e08e1ac..3dcf7bfb7398 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/tsconfig.json +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "ESNext", "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, "esModuleInterop": true, "jsx": "preserve", diff --git a/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts b/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts index cd48af8a04db..d3ffd97997a9 100644 --- a/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts +++ b/dev-packages/e2e-tests/test-applications/solidstart-2/vite.config.ts @@ -1,3 +1,4 @@ +import { sentrySolidStart } from '@sentry/solidstart/vite'; import { solidStart } from '@solidjs/start/config'; import { nitro } from 'nitro/vite'; import { defineConfig } from 'vite'; @@ -8,6 +9,13 @@ export default defineConfig({ appRoot: './src', middleware: './src/middleware.ts', }), - nitro(), + sentrySolidStart({ + org: process.env.E2E_TEST_SENTRY_ORG_SLUG, + project: process.env.E2E_TEST_SENTRY_PROJECT, + authToken: process.env.E2E_TEST_AUTH_TOKEN, + debug: true, + }), + // `serverDir` defaults to `false`, which skips plugin scanning entirely. + nitro({ serverDir: './server' }), ], });