diff --git a/packages/bundler-plugin-core/src/sentry/transports.ts b/packages/bundler-plugin-core/src/sentry/transports.ts index 0bcccee5..c6ab5f43 100644 --- a/packages/bundler-plugin-core/src/sentry/transports.ts +++ b/packages/bundler-plugin-core/src/sentry/transports.ts @@ -12,6 +12,8 @@ import type { TransportRequest, TransportRequestExecutor, } from "@sentry/types"; +import { join } from "node:path"; +import { appendFileSync, mkdirSync } from "node:fs"; // Estimated maximum size for reasonable standalone event const GZIP_THRESHOLD = 1024 * 32; @@ -105,6 +107,7 @@ export function makeOptionallyEnabledNodeTransport( ): (options: BaseTransportOptions) => Transport { return (nodeTransportOptions) => { const nodeTransport = makeNodeTransport(nodeTransportOptions); + return { flush: (timeout) => nodeTransport.flush(timeout), send: async (request) => { @@ -120,10 +123,9 @@ export function makeOptionallyEnabledNodeTransport( if (await shouldSendTelemetry) { if (process.env["SENTRY_TEST_OUT_DIR"]) { - // eslint-disable-next-line @typescript-eslint/unbound-method - const { join } = await import("node:path"); - const { appendFileSync } = await import("node:fs"); - const path = join(process.env["SENTRY_TEST_OUT_DIR"], "sentry-telemetry.json"); + const outDir = process.env["SENTRY_TEST_OUT_DIR"]; + mkdirSync(outDir, { recursive: true }); + const path = join(outDir, "sentry-telemetry.json"); appendFileSync(path, JSON.stringify(request) + ",\n"); return { statusCode: 200 }; } diff --git a/packages/integration-tests-next/fixtures/esbuild/telemetry.test.ts b/packages/integration-tests-next/fixtures/esbuild/telemetry.test.ts index 464d0d47..cdd52179 100644 --- a/packages/integration-tests-next/fixtures/esbuild/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/esbuild/telemetry.test.ts @@ -5,7 +5,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { runBundler(); expect(readOutputFiles()).toMatchInlineSnapshot(` { - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"esbuild","bundler-major-version":"28"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", "telemetry.js": "(() => { // _sentry-injection-stub diff --git a/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts b/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts index ebd149c8..f1cc4370 100644 --- a/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/rolldown/telemetry.test.ts @@ -17,7 +17,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { console.log("hello world"); //#endregion ", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"3"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts b/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts index 1585f17d..3f95d11e 100644 --- a/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/rollup3/telemetry.test.ts @@ -8,7 +8,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { "basic.js": "// eslint-disable-next-line no-console !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world"); ", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"3"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts b/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts index 1585f17d..667b55a1 100644 --- a/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/rollup4/telemetry.test.ts @@ -8,7 +8,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { "basic.js": "// eslint-disable-next-line no-console !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"CURRENT_SHA"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00000000-0000-0000-0000-000000000000",e._sentryDebugIdIdentifier="sentry-dbid-00000000-0000-0000-0000-000000000000");}catch(e){}}();console.log("hello world"); ", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"rollup","bundler-major-version":"4"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/fixtures/utils.ts b/packages/integration-tests-next/fixtures/utils.ts index 883f25c5..f3dabc3a 100644 --- a/packages/integration-tests-next/fixtures/utils.ts +++ b/packages/integration-tests-next/fixtures/utils.ts @@ -72,7 +72,13 @@ export function readAllFiles( "TIMESTAMP" ) .replace(/[a-f0-9]{32}/g, "UUID") + .replace(/"[a-f0-9]{16}"/g, '"SHORT_UUID"') + .replaceAll(process.version, "NODE_VERSION") + .replace(/"ci":false/g, '"ci":true') + .replace(/"platform":".+?"/g, '"platform":"PLATFORM"') .replace(/"duration":[\d.]+/g, '"duration":DURATION') + .replace(/"start_timestamp":[\d.]+/g, '"start_timestamp":START_TIMESTAMP') + .replace(/"timestamp":[\d.]+/g, '"timestamp":TIMESTAMP') .replace(/"release":"[\d.]+"/g, '"release":"PLUGIN_VERSION"'); } else { // Normalize Windows line endings for cross-platform snapshots diff --git a/packages/integration-tests-next/fixtures/vite4/telemetry.config.ts b/packages/integration-tests-next/fixtures/vite4/telemetry.config.ts index c02f3a57..dee23957 100644 --- a/packages/integration-tests-next/fixtures/vite4/telemetry.config.ts +++ b/packages/integration-tests-next/fixtures/vite4/telemetry.config.ts @@ -12,6 +12,8 @@ export default defineConfig({ entryFileNames: "[name].js", }, }, + // We already delete the directory and don't want our telemetry file to be deleted + emptyOutDir: false, }, plugins: [sentryVitePlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/vite4/telemetry.test.ts b/packages/integration-tests-next/fixtures/vite4/telemetry.test.ts index e41bc214..313815c9 100644 --- a/packages/integration-tests-next/fixtures/vite4/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/vite4/telemetry.test.ts @@ -16,7 +16,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { })(); console.log("hello world"); ", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"4"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/fixtures/vite7/telemetry.config.ts b/packages/integration-tests-next/fixtures/vite7/telemetry.config.ts index c02f3a57..dee23957 100644 --- a/packages/integration-tests-next/fixtures/vite7/telemetry.config.ts +++ b/packages/integration-tests-next/fixtures/vite7/telemetry.config.ts @@ -12,6 +12,8 @@ export default defineConfig({ entryFileNames: "[name].js", }, }, + // We already delete the directory and don't want our telemetry file to be deleted + emptyOutDir: false, }, plugins: [sentryVitePlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/vite7/telemetry.test.ts b/packages/integration-tests-next/fixtures/vite7/telemetry.test.ts index e41bc214..f90b8e95 100644 --- a/packages/integration-tests-next/fixtures/vite7/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/vite7/telemetry.test.ts @@ -16,7 +16,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { })(); console.log("hello world"); ", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"7"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/fixtures/vite8/telemetry.config.ts b/packages/integration-tests-next/fixtures/vite8/telemetry.config.ts index c02f3a57..dee23957 100644 --- a/packages/integration-tests-next/fixtures/vite8/telemetry.config.ts +++ b/packages/integration-tests-next/fixtures/vite8/telemetry.config.ts @@ -12,6 +12,8 @@ export default defineConfig({ entryFileNames: "[name].js", }, }, + // We already delete the directory and don't want our telemetry file to be deleted + emptyOutDir: false, }, plugins: [sentryVitePlugin(sentryConfig)], }); diff --git a/packages/integration-tests-next/fixtures/vite8/telemetry.test.ts b/packages/integration-tests-next/fixtures/vite8/telemetry.test.ts index e41bc214..093653dc 100644 --- a/packages/integration-tests-next/fixtures/vite8/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/vite8/telemetry.test.ts @@ -16,7 +16,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { })(); console.log("hello world"); ", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"vite","bundler-major-version":"8"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/fixtures/webpack5/telemetry.test.ts b/packages/integration-tests-next/fixtures/webpack5/telemetry.test.ts index afea545d..fcd6e517 100644 --- a/packages/integration-tests-next/fixtures/webpack5/telemetry.test.ts +++ b/packages/integration-tests-next/fixtures/webpack5/telemetry.test.ts @@ -13,7 +13,9 @@ test(import.meta.url, ({ runBundler, readOutputFiles, runFileInNode }) => { /******/ })() ;", - "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + "sentry-telemetry.json": "[{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":true,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"ok","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], + [{"event_id":"UUID","sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"},"trace":{"environment":"production","release":"PLUGIN_VERSION","public_key":"UUID","trace_id":"UUID","sample_rate":"1","transaction":"Sentry Bundler Plugin execution","sampled":"true"}},[[{"type":"transaction"},{"contexts":{"trace":{"span_id":"SHORT_UUID","trace_id":"UUID","data":{"sentry.origin":"manual","sentry.source":"custom","sentry.sample_rate":1},"origin":"manual"},"runtime":{"name":"node","version":"NODE_VERSION"}},"spans":[],"start_timestamp":START_TIMESTAMP,"timestamp":TIMESTAMP,"transaction":"Sentry Bundler Plugin execution","type":"transaction","transaction_info":{"source":"custom"},"platform":"PLATFORM","event_id":"UUID","environment":"production","release":"PLUGIN_VERSION","tags":{"upload-legacy-sourcemaps":false,"module-metadata":false,"inject-build-information":false,"set-commits":"auto","finalize-release":true,"deploy-options":false,"custom-error-handler":false,"sourcemaps-assets":false,"delete-after-upload":false,"sourcemaps-disabled":false,"react-annotate":false,"node":"NODE_VERSION","platform":"PLATFORM","meta-framework":"none","application-key-set":false,"ci":true,"project":"undefined","bundler":"webpack","bundler-major-version":"5"},"sdk":{"name":"sentry.javascript.node","version":"8.30.0","integrations":[],"packages":[{"name":"npm:@sentry/node","version":"8.30.0"}]}}]]], + [{"sent_at":"TIMESTAMP","sdk":{"name":"sentry.javascript.node","version":"8.30.0"}},[[{"type":"session"},{"sid":"UUID","init":false,"started":"TIMESTAMP","timestamp":"TIMESTAMP","status":"exited","errors":0,"duration":DURATION,"attrs":{"release":"PLUGIN_VERSION","environment":"production"}}]]], ", } `); diff --git a/packages/integration-tests-next/setup.mjs b/packages/integration-tests-next/setup.mjs index c83353b6..f2094301 100644 --- a/packages/integration-tests-next/setup.mjs +++ b/packages/integration-tests-next/setup.mjs @@ -27,7 +27,7 @@ for (const dir of directories) { continue; } - execSync("pnpm install", { + execSync("pnpm install --force", { cwd: dir, stdio: "inherit", });