diff --git a/.size-limit.js b/.size-limit.js index b28892aecb89..3f1be5b9c140 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -79,7 +79,7 @@ module.exports = [ path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'replayCanvasIntegration'), gzip: true, - limit: '79 KB', + limit: '78.2 KB', }, { name: '@sentry/browser (incl. Tracing, Replay, Feedback)', @@ -107,7 +107,7 @@ module.exports = [ path: 'packages/browser/build/npm/esm/index.js', import: createImport('init', 'feedbackAsyncIntegration'), gzip: true, - limit: '34 KB', + limit: '33 KB', }, // React SDK (ESM) { @@ -160,7 +160,7 @@ module.exports = [ name: 'CDN Bundle (incl. Tracing)', path: createCDNPath('bundle.tracing.min.js'), gzip: true, - limit: '39 KB', + limit: '38 KB', }, { name: 'CDN Bundle (incl. Tracing, Replay)', diff --git a/CHANGELOG.md b/CHANGELOG.md index ab6f9fb23635..1eea88c2fc17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,83 +10,6 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott -## 8.40.0 - -### Important Changes - -- **feat(angular): Support Angular 19 ([#14398](https://github.com/getsentry/sentry-javascript/pull/14398))** - - The `@sentry/angular` SDK can now be used with Angular 19. If you're upgrading to the new Angular version, you might want to migrate from the now deprecated `APP_INITIALIZER` token to `provideAppInitializer`. - In this case, change the Sentry `TraceService` initialization in `app.config.ts`: - - ```ts - // Angular 18 - export const appConfig: ApplicationConfig = { - providers: [ - // other providers - { - provide: TraceService, - deps: [Router], - }, - { - provide: APP_INITIALIZER, - useFactory: () => () => {}, - deps: [TraceService], - multi: true, - }, - ], - }; - - // Angular 19 - export const appConfig: ApplicationConfig = { - providers: [ - // other providers - { - provide: TraceService, - deps: [Router], - }, - provideAppInitializer(() => { - inject(TraceService); - }), - ], - }; - ``` - -- **feat(core): Deprecate `debugIntegration` and `sessionTimingIntegration` ([#14363](https://github.com/getsentry/sentry-javascript/pull/14363))** - - The `debugIntegration` was deprecated and will be removed in the next major version of the SDK. - To log outgoing events, use [Hook Options](https://docs.sentry.io/platforms/javascript/configuration/options/#hooks) (`beforeSend`, `beforeSendTransaction`, ...). - - The `sessionTimingIntegration` was deprecated and will be removed in the next major version of the SDK. - To capture session durations alongside events, use [Context](https://docs.sentry.io/platforms/javascript/enriching-events/context/) (`Sentry.setContext()`). - -- **feat(nestjs): Deprecate `@WithSentry` in favor of `@SentryExceptionCaptured` ([#14323](https://github.com/getsentry/sentry-javascript/pull/14323))** - - The `@WithSentry` decorator was deprecated. Use `@SentryExceptionCaptured` instead. This is a simple renaming and functionality stays identical. - -- **feat(nestjs): Deprecate `SentryTracingInterceptor`, `SentryService`, `SentryGlobalGenericFilter`, `SentryGlobalGraphQLFilter` ([#14371](https://github.com/getsentry/sentry-javascript/pull/14371))** - - The `SentryTracingInterceptor` was deprecated. If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`. If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards. - - The `SentryService` was deprecated and its functionality was added to `Sentry.init`. If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`. If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService` afterwards. - - The `SentryGlobalGenericFilter` was deprecated. Use the `SentryGlobalFilter` instead which is a drop-in replacement. - - The `SentryGlobalGraphQLFilter` was deprecated. Use the `SentryGlobalFilter` instead which is a drop-in replacement. - -- **feat(node): Deprecate `nestIntegration` and `setupNestErrorHandler` in favor of using `@sentry/nestjs` ([#14374](https://github.com/getsentry/sentry-javascript/pull/14374))** - - The `nestIntegration` and `setupNestErrorHandler` functions from `@sentry/node` were deprecated and will be removed in the next major version of the SDK. If you're using `@sentry/node` in a NestJS application, we recommend switching to our new dedicated `@sentry/nestjs` package. - -### Other Changes - -- feat(browser): Send additional LCP timing info ([#14372](https://github.com/getsentry/sentry-javascript/pull/14372)) -- feat(core): Ensure `normalizedRequest` on `sdkProcessingMetadata` is merged ([#14315](https://github.com/getsentry/sentry-javascript/pull/14315)) -- feat(core): Hoist everything from `@sentry/utils` into `@sentry/core` ([#14382](https://github.com/getsentry/sentry-javascript/pull/14382)) -- fix(core): Do not throw when trying to fill readonly properties ([#14402](https://github.com/getsentry/sentry-javascript/pull/14402)) -- fix(feedback): Fix `__self` and `__source` attributes on feedback nodes ([#14356](https://github.com/getsentry/sentry-javascript/pull/14356)) -- fix(nextjs): Update check for not found navigation error ([#14378](https://github.com/getsentry/sentry-javascript/pull/14378)) - ## 8.39.0 ### Important Changes diff --git a/dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts b/dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts index bf653dfad6b7..2e3951d3d45b 100644 --- a/dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts +++ b/dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts @@ -100,7 +100,7 @@ ${changedPaths.join('\n')} * Returns how many time one test should run based on the chosen mode and a bunch of heuristics */ function getPerTestRunCount(testPaths: string[]) { - if ((!process.env.TEST_RUN_COUNT || process.env.TEST_RUN_COUNT === 'AUTO') && testPaths.length > 0) { + if (process.env.TEST_RUN_COUNT === 'AUTO' && testPaths.length > 0) { // Run everything up to 100x, assuming that total runtime is less than 60min. // We assume an average runtime of 3s per test, times 4 (for different browsers) = 12s per detected testPaths // We want to keep overall runtime under 30min diff --git a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/inline/test.ts b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/inline/test.ts index 37767e81e9db..157e4d163067 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/inline/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/inline/test.ts @@ -5,7 +5,7 @@ import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../uti sentryTest( 'should add source context lines around stack frames from errors in Html inline JS', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // The error we're throwing in this test is thrown as "Script error." in Webkit. // We filter "Script error." out by default in `InboundFilters`. @@ -15,10 +15,9 @@ sentryTest( sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventReqPromise = waitForErrorRequestOnUrl(page, url); - await page.waitForFunction('window.Sentry'); const clickPromise = page.locator('#inline-error-btn').click(); diff --git a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts index 8fa8ec16cddd..522c895d7b2e 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/noAddedLines/test.ts @@ -3,8 +3,8 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../utils/helpers'; -sentryTest('should not add source context lines to errors from script files', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should not add source context lines to errors from script files', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventReqPromise = waitForErrorRequestOnUrl(page, url); diff --git a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/scriptTag/test.ts b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/scriptTag/test.ts index 86c19a22ccfb..7f974b9d55c3 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/ContextLines/scriptTag/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/ContextLines/scriptTag/test.ts @@ -5,7 +5,7 @@ import { envelopeRequestParser, waitForErrorRequestOnUrl } from '../../../../uti sentryTest( 'should add source context lines around stack frames from errors in Html script tags', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // The error we're throwing in this test is thrown as "Script error." in Webkit. // We filter "Script error." out by default in `InboundFilters`. @@ -15,10 +15,9 @@ sentryTest( sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventReqPromise = waitForErrorRequestOnUrl(page, url); - await page.waitForFunction('window.Sentry'); const clickPromise = page.locator('#inline-error-btn').click(); diff --git a/dev-packages/browser-integration-tests/suites/integrations/globalHandlers/fetchStackTrace/test.ts b/dev-packages/browser-integration-tests/suites/integrations/globalHandlers/fetchStackTrace/test.ts index 3d6790a36230..8d70241ec592 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/globalHandlers/fetchStackTrace/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/globalHandlers/fetchStackTrace/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should create errors with stack traces for failing fetch calls', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should create errors with stack traces for failing fetch calls', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const envelopes = await getMultipleSentryEnvelopeRequests(page, 3, { url, timeout: 10000 }); const errorEvent = envelopes.find(event => !event.type)!; diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts index f85aa63473d5..02a62142e02b 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; -sentryTest('httpContextIntegration captures user-agent and referrer', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('httpContextIntegration captures user-agent and referrer', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const errorEventPromise = getFirstSentryEnvelopeRequest(page); diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts index 8b4267c217e6..6318b337c165 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/axios/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; sentryTest( 'should assign request and response context from a failed 500 XHR request', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', route => { return route.fulfill({ diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts index d490f98426cd..6cf8d7c7187f 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts @@ -8,8 +8,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; // https://github.com/microsoft/playwright/issues/10376 sentryTest( 'should assign request and response context from a failed 500 fetch request', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', route => { return route.fulfill({ diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withAbortController/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withAbortController/test.ts index 0bf34e61b95a..6cc3a0cd32a9 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withAbortController/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withAbortController/test.ts @@ -3,12 +3,12 @@ import type { Event as SentryEvent } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../../utils/helpers'; -sentryTest('should handle aborted fetch calls', async ({ getLocalTestUrl, page }) => { +sentryTest('should handle aborted fetch calls', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', async () => { // never fulfil this route because we abort the request as part of the test diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts index 9fb6add1a2d5..e2dcd308417a 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequest/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('works with a Request passed in', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('works with a Request passed in', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', route => { return route.fulfill({ diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts index 485a52ed3fd4..98519cd32129 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndBodyAndOptions/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; sentryTest( 'works with a Request (with body) & options passed in - handling used body', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', route => { return route.fulfill({ diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts index d78860f7b1a6..4d3fe8458bac 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/withRequestAndOptions/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('works with a Request (without body) & options passed in', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('works with a Request (without body) & options passed in', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', route => { return route.fulfill({ diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts index 9953de1c860e..6595fc0a7399 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpclient/xhr/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; sentryTest( 'should assign request and response context from a failed 500 XHR request', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', route => { return route.fulfill({ diff --git a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts index 8e9401e67be1..d6414e154a23 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadata/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should provide module_metadata on stack frames in beforeSend', async ({ getLocalTestUrl, page }) => { +sentryTest('should provide module_metadata on stack frames in beforeSend', async ({ getLocalTestPath, page }) => { // moduleMetadataIntegration is not included in any CDN bundles if (process.env.PW_BUNDLE?.startsWith('bundle')) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const errorEvent = await getFirstSentryEnvelopeRequest(page, url); expect(errorEvent.extra?.['module_metadata_entries']).toEqual([{ foo: 'bar' }]); diff --git a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts index 04e8f24adfaf..6996ef1ded6d 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/moduleMetadata/appliesMetadataWithRewriteFrames/test.ts @@ -6,13 +6,13 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; sentryTest( 'should provide module_metadata on stack frames in beforeSend even though an event processor (rewriteFramesIntegration) modified the filename', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { // moduleMetadataIntegration is not included in any CDN bundles if (process.env.PW_BUNDLE?.startsWith('bundle')) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const errorEvent = await getFirstSentryEnvelopeRequest(page, url); expect(errorEvent?.extra?.['module_metadata_entries']).toEqual([{ foo: 'baz' }]); diff --git a/dev-packages/browser-integration-tests/suites/metrics/metricsShim/test.ts b/dev-packages/browser-integration-tests/suites/metrics/metricsShim/test.ts index e8d0dbcfb274..d95633393eda 100644 --- a/dev-packages/browser-integration-tests/suites/metrics/metricsShim/test.ts +++ b/dev-packages/browser-integration-tests/suites/metrics/metricsShim/test.ts @@ -3,7 +3,7 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { shouldSkipMetricsTest } from '../../../utils/helpers'; -sentryTest('exports shim metrics integration for non-tracing bundles', async ({ getLocalTestUrl, page }) => { +sentryTest('exports shim metrics integration for non-tracing bundles', async ({ getLocalTestPath, page }) => { // Skip in tracing tests if (!shouldSkipMetricsTest()) { sentryTest.skip(); @@ -22,7 +22,7 @@ sentryTest('exports shim metrics integration for non-tracing bundles', async ({ }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts index 32f3e0758de2..47435f3d57be 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/empty_obj/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; sentryTest( 'should add an empty breadcrumb initialized with a timestamp, when an empty object is given', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts index 43fd59b5b1dc..bbaafa997fda 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/multiple_breadcrumbs/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should add multiple breadcrumbs', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should add multiple breadcrumbs', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts index 3eba0e1ecc48..d6a24b8cc167 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/simple_breadcrumb/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should add a simple breadcrumb', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should add a simple breadcrumb', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts index 3837262b69a9..ec04b9027783 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/addBreadcrumb/undefined_arg/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; sentryTest( 'should add an empty breadcrumb initialized with a timestamp, when no argument is given', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts index 0c0a35859dd0..3a8865ec3672 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/classInstance/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture an POJO', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture an POJO', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/emptyObj/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/emptyObj/test.ts index 712f599f30d5..fa6b1dcb1562 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/emptyObj/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/emptyObj/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture an empty object', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture an empty object', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/event/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/event/test.ts index d212a027ec53..65c46a776731 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/event/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/event/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture an Event', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture an Event', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/eventBreadcrumbs/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/eventBreadcrumbs/test.ts index 4dc6bd0c7311..831c255cb8f8 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/eventBreadcrumbs/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/eventBreadcrumbs/test.ts @@ -6,8 +6,8 @@ import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; sentryTest( 'should capture recorded transactions as breadcrumbs for the following event sent', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const events = await getMultipleSentryEnvelopeRequests(page, 2, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/linkedErrors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/linkedErrors/test.ts index 9136f11ceae0..b78ae5e12525 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/linkedErrors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/linkedErrors/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture a linked error with messages', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a linked error with messages', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsDifferentStacktrace/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsDifferentStacktrace/test.ts index 103c0c1d1dc5..277c518d58f0 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsDifferentStacktrace/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsDifferentStacktrace/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should not reject back-to-back errors with different stack traces', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should not reject back-to-back errors with different stack traces', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getMultipleSentryEnvelopeRequests(page, 3, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsSameStacktrace/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsSameStacktrace/test.ts index 7ef825b0b147..acd7e12ed351 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsSameStacktrace/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/multipleErrorsSameStacktrace/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should reject duplicate, back-to-back errors from captureException', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should reject duplicate, back-to-back errors from captureException', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getMultipleSentryEnvelopeRequests(page, 7, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/plainObject/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/plainObject/test.ts index 1f31b1738bb4..e81fe0125906 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/plainObject/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/plainObject/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture an class instance', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture an class instance', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/transactionBreadcrumbs/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/transactionBreadcrumbs/test.ts index 4383d92a6f73..c69437183591 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/transactionBreadcrumbs/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/transactionBreadcrumbs/test.ts @@ -6,8 +6,8 @@ import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; sentryTest( 'should capture recorded transactions as breadcrumbs for the following event sent', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const events = await getMultipleSentryEnvelopeRequests(page, 2, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureException/undefinedArg/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureException/undefinedArg/test.ts index a7e8dfc93116..5bf560e93707 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureException/undefinedArg/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureException/undefinedArg/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture an undefined error when no arguments are provided', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture an undefined error when no arguments are provided', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/multipleMessageAttachStacktrace/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/multipleMessageAttachStacktrace/test.ts index a16afd870fd9..01845d983feb 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/multipleMessageAttachStacktrace/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/multipleMessageAttachStacktrace/test.ts @@ -6,8 +6,8 @@ import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; sentryTest( 'should reject duplicate, back-to-back messages from captureMessage when it has stacktrace', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getMultipleSentryEnvelopeRequests(page, 5, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts index c507f8a7d8c6..db84460b85b5 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/parameterized_message/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture a parameterized representation of the message', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a parameterized representation of the message', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/simple_message/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/simple_message/test.ts index 50df0b1c38df..60cc4a19f089 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/simple_message/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/simple_message/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture a simple message string', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a simple message string', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/with_level/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/with_level/test.ts index 96b3a98276df..1422ed64bf31 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureMessage/with_level/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureMessage/with_level/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should capture with different severity levels', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture with different severity levels', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const events = await getMultipleSentryEnvelopeRequests(page, 6, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/simple_feedback/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/simple_feedback/test.ts index 6c3ffdbc969f..158fb60d3d93 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/simple_feedback/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/simple_feedback/test.ts @@ -4,8 +4,8 @@ import type { UserFeedback } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should capture simple user feedback', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture simple user feedback', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/test.ts index 800489456525..d81b2c7a3db1 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureException/test.ts @@ -4,8 +4,8 @@ import type { Event, UserFeedback } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('capture user feedback when captureException is called', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('capture user feedback when captureException is called', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | UserFeedback)[]; diff --git a/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/test.ts b/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/test.ts index 7b0b5ad2f2ed..808279e2035f 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/captureUserFeedback/withCaptureMessage/test.ts @@ -4,8 +4,8 @@ import type { Event, UserFeedback } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('capture user feedback when captureMessage is called', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('capture user feedback when captureMessage is called', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const data = (await getMultipleSentryEnvelopeRequests(page, 2, { url })) as (Event | UserFeedback)[]; diff --git a/dev-packages/browser-integration-tests/suites/public-api/denyUrls/test.ts b/dev-packages/browser-integration-tests/suites/public-api/denyUrls/test.ts index c562b0fb9c09..c374e8ae766c 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/denyUrls/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/denyUrls/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; -sentryTest('should allow to ignore specific urls', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should allow to ignore specific urls', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/ignoreErrors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/ignoreErrors/test.ts index 809e47e66a8b..35752ae39232 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/ignoreErrors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/ignoreErrors/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../utils/helpers'; -sentryTest('should allow to ignore specific errors', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should allow to ignore specific errors', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const events = await getMultipleSentryEnvelopeRequests(page, 2, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/init/console/test.ts b/dev-packages/browser-integration-tests/suites/public-api/init/console/test.ts index c581f3945f4d..5fc32e430caf 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/init/console/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/init/console/test.ts @@ -5,8 +5,8 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; // Regression test against https://github.com/getsentry/sentry-javascript/issues/4558 -sentryTest('should not change console output', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should not change console output', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); // https://playwright.dev/docs/api/class-page#page-event-console page.on('console', (msg: ConsoleMessage) => { diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/instrumentation-behaviour/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/instrumentation-behaviour/test.ts index 2126ba3c3d35..557211e5b668 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/instrumentation-behaviour/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/instrumentation-behaviour/test.ts @@ -4,8 +4,8 @@ import { sentryTest } from '../../../../../utils/fixtures'; sentryTest( 'Event listener instrumentation should attach the same event listener only once', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); let functionListenerCalls = 0; diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts index 9ab0c5030bab..a61e582254ee 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/named-function/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should capture built-in handlers fn name in mechanism data', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture built-in handlers fn name in mechanism data', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/original-callback/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/original-callback/test.ts index 964ed6c575f9..82866a35105a 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/original-callback/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/original-callback/test.ts @@ -4,8 +4,8 @@ import { sentryTest } from '../../../../../utils/fixtures'; sentryTest( 'should remove the original callback if it was registered before Sentry initialized (w. original method)', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts index d8047a044646..8451472568a8 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/remove/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should transparently remove event listeners from wrapped functions', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should transparently remove event listeners from wrapped functions', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/this-preservation/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/this-preservation/test.ts index 0f71c89e250a..462db45c6052 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/this-preservation/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/this-preservation/test.ts @@ -2,8 +2,8 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../../utils/fixtures'; -sentryTest('Event listener instrumentation preserves "this" context', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('Event listener instrumentation preserves "this" context', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); let assertions = 0; diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts index 3a4313ae044e..1c0bbb66fa12 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/thrown-error/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; sentryTest( 'Event listener instrumentation should capture an error thrown in an event handler', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/wrapping/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/wrapping/test.ts index 14159609b2bf..def52f9ce465 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/wrapping/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/eventListener/wrapping/test.ts @@ -4,8 +4,8 @@ import { sentryTest } from '../../../../../utils/fixtures'; sentryTest( 'Event listener instrumentation should not wrap event listeners multiple times', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const functionListenerStackHeights: number[] = []; diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts index a9002579e912..86227532efb1 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/non-string-arg/test.ts @@ -6,13 +6,13 @@ import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../. sentryTest( 'should catch onerror calls with non-string first argument gracefully', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts index 53c16ad46e23..58a35d86a800 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/rethrown/test.ts @@ -6,13 +6,13 @@ import { getMultipleSentryEnvelopeRequests, runScriptInSandbox } from '../../../ sentryTest( 'should NOT catch an exception already caught [but rethrown] via Sentry.captureException', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts index cd08b56ccee5..46b68f8ccb24 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/syntax-errors/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch syntax errors', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('should catch syntax errors', async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts index 27dbcc771431..47607a22b289 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-errors/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch thrown errors', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('should catch thrown errors', async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts index 37a70678a2de..71159b605b4e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-objects/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch thrown objects', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('should catch thrown objects', async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts index 1245feb862e5..ff98e805f9aa 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onError/thrown-strings/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, runScriptInSandbox } from '../../../../../utils/helpers'; -sentryTest('should catch thrown strings', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('should catch thrown strings', async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/custom-event/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/custom-event/test.ts index 0f0bc09ed6d7..50f857535acb 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/custom-event/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/custom-event/test.ts @@ -11,8 +11,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; // https://github.com/getsentry/sentry-javascript/issues/2380 sentryTest( 'should capture PromiseRejectionEvent cast to CustomEvent with type unhandledrejection', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/event/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/event/test.ts index 167cdc48870f..8a26aa807062 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/event/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/event/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; // there's no evidence that this actually happens, but it could, and our code correctly // handles it, so might as well prevent future regression on that score -sentryTest('should capture a random Event with type unhandledrejection', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a random Event with type unhandledrejection', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-errors/test.ts index 2d18376174c7..27babe008d76 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-errors/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should catch thrown errors', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should catch thrown errors', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-null/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-null/test.ts index f350ed0de639..d047f5f024aa 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-null/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-null/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should catch thrown strings', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-number/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-number/test.ts index 7fefb9037427..60cbeb9c57f8 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-number/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-number/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should catch thrown strings', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-object-complex/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-object-complex/test.ts index 80a23927d9b5..e8c400045eb5 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-object-complex/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-object-complex/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should capture unhandledrejection with a complex object', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture unhandledrejection with a complex object', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-objects/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-objects/test.ts index e4e5fcfa2248..a82296cc614c 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-objects/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-objects/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should capture unhandledrejection with an object', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture unhandledrejection with an object', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-string-large/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-string-large/test.ts index 1bec29f18f6d..bb0a5ab255d2 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-string-large/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-string-large/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should capture unhandledrejection with a large string', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture unhandledrejection with a large string', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-strings/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-strings/test.ts index 91faa5536079..74eb2a939444 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-strings/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-strings/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should catch thrown strings', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-undefined/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-undefined/test.ts index 2195725a6599..f874e04b1802 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-undefined/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/onUnhandledRejection/thrown-undefined/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should catch thrown strings', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should catch thrown strings', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts index d111a0b473d7..0840789c759d 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/callback/test.ts @@ -4,8 +4,8 @@ import { sentryTest } from '../../../../../utils/fixtures'; sentryTest( 'wrapped callback should preserve correct context - window (not-bound)', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); @@ -24,8 +24,8 @@ sentryTest( sentryTest( 'wrapped callback should preserve correct context - `bind` bound method', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts index e39e4c20a27b..df437f34c0ef 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/requestAnimationFrame/thrown-errors/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('should capture exceptions inside callback', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture exceptions inside callback', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts index cdf8a4be9eb2..6da1e21dea1e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setInterval/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('Instrumentation should capture errors in setInterval', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('Instrumentation should capture errors in setInterval', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts index be46196aa754..fce63e657b49 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeout/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('Instrumentation should capture errors in setTimeout', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('Instrumentation should capture errors in setTimeout', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts index 1fdee574b3f2..91e82f8b1dcd 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/setTimeoutFrozen/test.ts @@ -6,11 +6,11 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; sentryTest( 'Instrumentation does not fail when using frozen callback for setTimeout', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { const bundleKey = process.env.PW_BUNDLE || ''; const hasDebug = !bundleKey.includes('_min'); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const logMessages: string[] = []; diff --git a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts index 0a2114232e48..1b213b2fb6bc 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/instrumentation/xhr/thrown-error/test.ts @@ -6,8 +6,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; sentryTest( 'should capture exceptions from XMLHttpRequest event handlers (e.g. onreadystatechange)', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setContext/multiple_contexts/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setContext/multiple_contexts/test.ts index 8e11f0cfde64..29ab95edb776 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setContext/multiple_contexts/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setContext/multiple_contexts/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should record multiple contexts', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should record multiple contexts', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setContext/non_serializable_context/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setContext/non_serializable_context/test.ts index a54080159c2b..9b270205f109 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setContext/non_serializable_context/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setContext/non_serializable_context/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should normalize non-serializable context', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should normalize non-serializable context', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setContext/simple_context/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setContext/simple_context/test.ts index 1697d8735ede..37e91dbf314d 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setContext/simple_context/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setContext/simple_context/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should set a simple context', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should set a simple context', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setExtra/multiple_extras/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setExtra/multiple_extras/test.ts index e6d0b0a63f9e..17e5fa9790c7 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setExtra/multiple_extras/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setExtra/multiple_extras/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should record multiple extras of different types', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should record multiple extras of different types', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts index 3a107189fc16..67b2e9cd162c 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setExtra/non_serializable_extra/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should normalize non-serializable extra', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should normalize non-serializable extra', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setExtra/simple_extra/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setExtra/simple_extra/test.ts index 8c3557d9f047..3f77998cd758 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setExtra/simple_extra/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setExtra/simple_extra/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should record a simple extra object', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should record a simple extra object', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts index 64f9101b7057..555686058366 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setExtras/consecutive_calls/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should set extras from multiple consecutive calls', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should set extras from multiple consecutive calls', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setExtras/multiple_extras/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setExtras/multiple_extras/test.ts index b57f70b80c2b..fdea76a5344a 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setExtras/multiple_extras/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setExtras/multiple_extras/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should record an extras object', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should record an extras object', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts index 2cbe0683e434..3eff6ec07858 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_non_primitives/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should not accept non-primitive tags', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should not accept non-primitive tags', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts index 3eb7567247c7..915c39a51596 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setTag/with_primitives/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should set primitive tags', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should set primitive tags', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setTags/with_non_primitives/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setTags/with_non_primitives/test.ts index 2cbe0683e434..3eff6ec07858 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setTags/with_non_primitives/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setTags/with_non_primitives/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should not accept non-primitive tags', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should not accept non-primitive tags', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setTags/with_primitives/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setTags/with_primitives/test.ts index 3eb7567247c7..915c39a51596 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setTags/with_primitives/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setTags/with_primitives/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; -sentryTest('should set primitive tags', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should set primitive tags', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setUser/unset_user/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setUser/unset_user/test.ts index dbf5943c7814..193a10b8677d 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setUser/unset_user/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setUser/unset_user/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should unset user', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should unset user', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getMultipleSentryEnvelopeRequests(page, 3, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/setUser/update_user/test.ts b/dev-packages/browser-integration-tests/suites/public-api/setUser/update_user/test.ts index 915265a9a030..f673280d5c0b 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/setUser/update_user/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/setUser/update_user/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should update user', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should update user', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getMultipleSentryEnvelopeRequests(page, 2, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/showReportDialog/inject-script/test.ts b/dev-packages/browser-integration-tests/suites/public-api/showReportDialog/inject-script/test.ts index 17a7fd27ad18..e0db0d21cf53 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/showReportDialog/inject-script/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/showReportDialog/inject-script/test.ts @@ -2,8 +2,8 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; -sentryTest('should inject dialog script into with correct attributes', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should inject dialog script into with correct attributes', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const dialogScriptSelector = 'head > script[src^="https://dsn.ingest.sentry.io/api/embed/error-page"]'; diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/attributes/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/attributes/test.ts index 056fa71c0ebe..a5e3e651467a 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/attributes/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/attributes/test.ts @@ -7,12 +7,12 @@ import { waitForTransactionRequestOnUrl, } from '../../../../utils/helpers'; -sentryTest('sends an empty string attribute', async ({ getLocalTestUrl, page }) => { +sentryTest('sends an empty string attribute', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const req = await waitForTransactionRequestOnUrl(page, url); const transaction = envelopeRequestParser(req); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts index e4b14c17097a..3b64a1230a5b 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/test.ts @@ -14,12 +14,12 @@ import { sentryTest( 'sends a transaction in an envelope with manual origin and custom source', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const req = await waitForTransactionRequestOnUrl(page, url); const transaction = envelopeRequestParser(req); @@ -37,12 +37,12 @@ sentryTest( }, ); -sentryTest('should report finished spans as children of the root transaction', async ({ getLocalTestUrl, page }) => { +sentryTest('should report finished spans as children of the root transaction', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const req = await waitForTransactionRequestOnUrl(page, url); const transaction = envelopeRequestParser(req); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/circular_data/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/circular_data/test.ts index bb125b5f5448..b6e88e821cbb 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/circular_data/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/circular_data/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should be able to handle circular data', async ({ getLocalTestUrl, page }) => { +sentryTest('should be able to handle circular data', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); expect(eventData.type).toBe('transaction'); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-reject/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-reject/test.ts index 62beb28adcbe..e328d4869b24 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-reject/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-reject/test.ts @@ -6,12 +6,12 @@ import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../ sentryTest( 'should capture a promise rejection within an async startSpan callback', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const envelopePromise = getMultipleSentryEnvelopeRequests(page, 2); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw-not-awaited/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw-not-awaited/test.ts index 0bfb51c8863d..5ef6f22419d1 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw-not-awaited/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw-not-awaited/test.ts @@ -6,13 +6,13 @@ import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../ sentryTest( "should capture a thrown error within an async startSpan callback that's not awaited properly", - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } const envelopePromise = getMultipleSentryEnvelopeRequests(page, 2); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const clickPromise = page.getByText('Button 1').click(); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw/test.ts index 9d966312973f..15ee3b9bd4de 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-async-throw/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should capture a thrown error within an async startSpan callback', async ({ getLocalTestUrl, page }) => { +sentryTest('should capture a thrown error within an async startSpan callback', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } const envelopePromise = getMultipleSentryEnvelopeRequests(page, 2); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const clickPromise = page.getByText('Button 1').click(); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts index 1894cac93ec9..4c4388dab435 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/error-sync/test.ts @@ -10,7 +10,7 @@ import { sentryTest( 'should capture an error within a sync startSpan callback', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); @@ -20,7 +20,7 @@ sentryTest( sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/setMeasurement/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/setMeasurement/test.ts index 535d2dd7fc70..fe45323474f0 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/setMeasurement/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/setMeasurement/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should attach measurement to transaction', async ({ getLocalTestUrl, page }) => { +sentryTest('should attach measurement to transaction', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const event = await getFirstSentryEnvelopeRequest(page, url); expect(event.measurements?.['metric.foo'].value).toBe(42); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts index 7f3d21d22602..7c93f923164b 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts @@ -10,12 +10,12 @@ import { sentryTest( 'sends a transaction and a span envelope if a standalone span is created as a child of an ongoing span tree', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const envelopes = await getMultipleSentryEnvelopeRequests( page, 2, diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/test.ts index c83ba3bc61cd..c8d05c056b20 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-sdk-disabled/test.ts @@ -3,12 +3,12 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest("doesn't send a standalone span envelope if SDK is disabled", async ({ getLocalTestUrl, page }) => { +sentryTest("doesn't send a standalone span envelope if SDK is disabled", async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); // @ts-expect-error this exists in the test init/subject diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts index d871ead881a9..256f047b5f9e 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts @@ -8,12 +8,12 @@ import { shouldSkipTracingTest, } from '../../../../utils/helpers'; -sentryTest('sends a segment span envelope', async ({ getLocalTestUrl, page }) => { +sentryTest('sends a segment span envelope', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const spanEnvelope = await getFirstSentryEnvelopeRequest(page, url, properFullEnvelopeRequestParser); const headers = spanEnvelope[0]; diff --git a/dev-packages/browser-integration-tests/suites/public-api/withScope/nested_scopes/test.ts b/dev-packages/browser-integration-tests/suites/public-api/withScope/nested_scopes/test.ts index 07708d3f6df9..415a173bc64f 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/withScope/nested_scopes/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/withScope/nested_scopes/test.ts @@ -4,8 +4,8 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests } from '../../../../utils/helpers'; -sentryTest('should allow nested scoping', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should allow nested scoping', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getMultipleSentryEnvelopeRequests(page, 5, { url }); diff --git a/dev-packages/browser-integration-tests/suites/public-api/withScope/throwError/test.ts b/dev-packages/browser-integration-tests/suites/public-api/withScope/throwError/test.ts index 589b1e5c6f45..cb21bebb8241 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/withScope/throwError/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/withScope/throwError/test.ts @@ -15,8 +15,8 @@ import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; */ sentryTest( 'withScope scope is NOT applied to thrown error caught by global handler', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/replay/bufferModeManual/test.ts b/dev-packages/browser-integration-tests/suites/replay/bufferModeManual/test.ts index b3578c98f1b0..8d6d87e40d36 100644 --- a/dev-packages/browser-integration-tests/suites/replay/bufferModeManual/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/bufferModeManual/test.ts @@ -15,7 +15,7 @@ import { sentryTest( '[buffer-mode] manually start buffer mode and capture buffer', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This was sometimes flaky on webkit, so skipping for now if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -45,7 +45,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await page.locator('#go-background').click(); @@ -161,7 +161,7 @@ sentryTest( sentryTest( '[buffer-mode] manually start buffer mode and capture buffer, but do not continue as session', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This was sometimes flaky on webkit, so skipping for now if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -190,7 +190,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await page.locator('#go-background').click(); @@ -394,7 +394,7 @@ sentryTest( // error happens. sentryTest( '[buffer-mode] can sample on each error event', - async ({ getLocalTestUrl, page, browserName, enableConsole }) => { + async ({ getLocalTestPath, page, browserName, enableConsole }) => { if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); } @@ -424,7 +424,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); // Start buffering and assert that it is enabled diff --git a/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/test.ts b/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/test.ts index c26692196e2b..89c4f4d4f369 100644 --- a/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/test.ts @@ -8,14 +8,14 @@ import { waitForReplayRunning, } from '../../../utils/replayHelpers'; -sentryTest('continues buffer session in session mode after error & reload', async ({ getLocalTestUrl, page }) => { +sentryTest('continues buffer session in session mode after error & reload', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise1 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/captureComponentName/test.ts b/dev-packages/browser-integration-tests/suites/replay/captureComponentName/test.ts index da97924804dc..29c400f4288d 100644 --- a/dev-packages/browser-integration-tests/suites/replay/captureComponentName/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/captureComponentName/test.ts @@ -3,14 +3,14 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { getCustomRecordingEvents, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('captures component name attribute when available', async ({ forceFlushReplay, getLocalTestUrl, page }) => { +sentryTest('captures component name attribute when available', async ({ forceFlushReplay, getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await reqPromise0; @@ -80,14 +80,14 @@ sentryTest('captures component name attribute when available', async ({ forceFlu ]); }); -sentryTest('sets element name to component name attribute', async ({ forceFlushReplay, getLocalTestUrl, page }) => { +sentryTest('sets element name to component name attribute', async ({ forceFlushReplay, getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await reqPromise0; diff --git a/dev-packages/browser-integration-tests/suites/replay/captureConsoleLog/test.ts b/dev-packages/browser-integration-tests/suites/replay/captureConsoleLog/test.ts index 88693c7bdae1..b55b23c10f04 100644 --- a/dev-packages/browser-integration-tests/suites/replay/captureConsoleLog/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/captureConsoleLog/test.ts @@ -3,14 +3,14 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { getCustomRecordingEvents, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('should capture console messages in replay', async ({ getLocalTestUrl, page, forceFlushReplay }) => { +sentryTest('should capture console messages in replay', async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await Promise.all([page.goto(url), reqPromise0]); @@ -46,14 +46,14 @@ sentryTest('should capture console messages in replay', async ({ getLocalTestUrl ); }); -sentryTest('should capture very large console logs', async ({ getLocalTestUrl, page, forceFlushReplay }) => { +sentryTest('should capture very large console logs', async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await Promise.all([page.goto(url), reqPromise0]); diff --git a/dev-packages/browser-integration-tests/suites/replay/captureReplayOffline/test.ts b/dev-packages/browser-integration-tests/suites/replay/captureReplayOffline/test.ts index b8b30184b754..f22abf0e3451 100644 --- a/dev-packages/browser-integration-tests/suites/replay/captureReplayOffline/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/captureReplayOffline/test.ts @@ -3,7 +3,7 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('should capture replays offline', async ({ getLocalTestUrl, page }) => { +sentryTest('should capture replays offline', async ({ getLocalTestPath, page }) => { // makeBrowserOfflineTransport is not included in any CDN bundles if (shouldSkipReplayTest() || (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle'))) { sentryTest.skip(); @@ -12,7 +12,7 @@ sentryTest('should capture replays offline', async ({ getLocalTestUrl, page }) = const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); // This would be the obvious way to test offline support but it doesn't appear to work! // await context.setOffline(true); diff --git a/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/test.ts b/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/test.ts index 01c006f5643d..a719bcd1d844 100644 --- a/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/test.ts @@ -12,14 +12,14 @@ import { sentryTest( 'replay recording should allow to disable compression', - async ({ getLocalTestUrl, page, forceFlushReplay }) => { + async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/test.ts b/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/test.ts index 353a5cbb2227..753fe57a0c01 100644 --- a/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/test.ts @@ -10,14 +10,14 @@ import { waitForReplayRequest, } from '../../../utils/replayHelpers'; -sentryTest('replay recording should be compressed by default', async ({ getLocalTestUrl, page, forceFlushReplay }) => { +sentryTest('replay recording should be compressed by default', async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/customEvents/test.ts b/dev-packages/browser-integration-tests/suites/replay/customEvents/test.ts index 49449ca46209..5c93870d0937 100644 --- a/dev-packages/browser-integration-tests/suites/replay/customEvents/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/customEvents/test.ts @@ -23,7 +23,7 @@ import { sentryTest( 'replay recording should contain default performance spans', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // We only test this against the NPM package and replay bundles // and only on chromium as most performance entries are only available in chromium if (shouldSkipReplayTest() || browserName !== 'chromium') { @@ -33,7 +33,7 @@ sentryTest( const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const replayEvent0 = getReplayEvent(await reqPromise0); @@ -76,7 +76,7 @@ sentryTest( sentryTest( 'replay recording should contain a click breadcrumb when a button is clicked', - async ({ forceFlushReplay, getLocalTestUrl, page, browserName }) => { + async ({ forceFlushReplay, getLocalTestPath, page, browserName }) => { // TODO(replay): This is flakey on webkit where clicks are flakey if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -87,7 +87,7 @@ sentryTest( const reqPromise2 = waitForReplayRequest(page, 2); const reqPromise3 = waitForReplayRequest(page, 3); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await reqPromise0; @@ -173,7 +173,7 @@ sentryTest( sentryTest( 'replay recording should contain an "options" breadcrumb for Replay SDK configuration', - async ({ forceFlushReplay, getLocalTestUrl, page, browserName }) => { + async ({ forceFlushReplay, getLocalTestPath, page, browserName }) => { // TODO(replay): This is flakey on webkit where clicks are flakey if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -182,7 +182,7 @@ sentryTest( const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts index e95653f3cadc..62961caef062 100644 --- a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts @@ -18,13 +18,13 @@ type TestWindow = Window & { sentryTest( 'should add replay_id to dsc of transactions when in session mode', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This is flaky on webkit, so skipping there... if (shouldSkipReplayTest() || shouldSkipTracingTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const transactionReq = waitForTransactionRequest(page); @@ -68,13 +68,13 @@ sentryTest( sentryTest( 'should not add replay_id to dsc of transactions when in buffer mode', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This is flaky on webkit, so skipping there... if (shouldSkipReplayTest() || shouldSkipTracingTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const transactionReq = waitForTransactionRequest(page); @@ -114,13 +114,13 @@ sentryTest( sentryTest( 'should add replay_id to dsc of transactions when switching from buffer to session mode', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This is flaky on webkit, so skipping there... if (shouldSkipReplayTest() || shouldSkipTracingTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const transactionReq = waitForTransactionRequest(page); @@ -167,13 +167,13 @@ sentryTest( sentryTest( 'should not add replay_id to dsc of transactions if replay is not enabled', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This is flaky on webkit, so skipping there... if (shouldSkipReplayTest() || shouldSkipTracingTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const transactionReq = waitForTransactionRequest(page); @@ -206,14 +206,14 @@ sentryTest( }, ); -sentryTest('should add replay_id to error DSC while replay is active', async ({ getLocalTestUrl, page }) => { +sentryTest('should add replay_id to error DSC while replay is active', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const hasTracing = !shouldSkipTracingTest(); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const error1Req = waitForErrorRequest(page, event => event.exception?.values?.[0].value === 'This is error #1'); diff --git a/dev-packages/browser-integration-tests/suites/replay/errorResponse/test.ts b/dev-packages/browser-integration-tests/suites/replay/errorResponse/test.ts index 0811ecac90f3..048ca898d892 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errorResponse/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/errorResponse/test.ts @@ -8,7 +8,7 @@ import { waitForReplayRequest, } from '../../../utils/replayHelpers'; -sentryTest('should stop recording after receiving an error response', async ({ getLocalTestUrl, page }) => { +sentryTest('should stop recording after receiving an error response', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -22,7 +22,7 @@ sentryTest('should stop recording after receiving an error response', async ({ g }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await Promise.all([page.goto(url), waitForReplayRequest(page)]); await page.locator('button').click(); diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/test.ts b/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/test.ts index 8c459d31b534..71cea051ce94 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/test.ts @@ -5,13 +5,13 @@ import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRunning } from '. sentryTest( '[error-mode] should not flush if error event is ignored in beforeErrorSampling', - async ({ getLocalTestUrl, page, browserName, forceFlushReplay }) => { + async ({ getLocalTestPath, page, browserName, forceFlushReplay }) => { // Skipping this in webkit because it is flakey there if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await waitForReplayRunning(page); diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/test.ts b/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/test.ts index 58e0ffde9ee4..2ae046bf6c58 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/test.ts @@ -6,7 +6,7 @@ import { getReplaySnapshot, isReplayEvent, shouldSkipReplayTest } from '../../.. sentryTest( '[error-mode] should not start recording if an error occurred when the error was dropped', - async ({ getLocalTestUrl, page, forceFlushReplay }) => { + async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -28,7 +28,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/errorMode/test.ts b/dev-packages/browser-integration-tests/suites/replay/errors/errorMode/test.ts index fe47856b276c..8eeb544d06ef 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/errorMode/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/errors/errorMode/test.ts @@ -17,7 +17,7 @@ import { sentryTest( '[error-mode] should start recording and switch to session mode once an error is thrown', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { // This was sometimes flaky on webkit, so skipping for now if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -48,7 +48,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await Promise.all([ page.goto(url), @@ -93,7 +93,7 @@ sentryTest( expect(content0.fullSnapshots).toHaveLength(1); // We don't know how many incremental snapshots we'll have (also browser-dependent), // but we know that we have at least 5 - expect(content0.incrementalSnapshots.length).toBeGreaterThanOrEqual(5); + expect(content0.incrementalSnapshots.length).toBeGreaterThan(5); // We want to make sure that the event that triggered the error was recorded. expect(content0.breadcrumbs).toEqual( expect.arrayContaining([ diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/test.ts b/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/test.ts index b43c00593e5a..123ec1609a04 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/test.ts @@ -5,7 +5,7 @@ import { getReplaySnapshot, shouldSkipReplayTest } from '../../../../utils/repla sentryTest( '[error-mode] should handle errors that result in API error response', - async ({ getLocalTestUrl, page, forceFlushReplay }) => { + async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -21,7 +21,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/test.ts b/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/test.ts index 1b2af02ca2fb..bc9453f58135 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/test.ts @@ -12,7 +12,7 @@ import { sentryTest( '[session-mode] replay event should contain an error id of an error that occurred during session recording', - async ({ getLocalTestUrl, page, browserName, forceFlushReplay }) => { + async ({ getLocalTestPath, page, browserName, forceFlushReplay }) => { // Skipping this in webkit because it is flakey there if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -37,7 +37,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); const req0 = await reqPromise0; @@ -85,7 +85,7 @@ sentryTest( sentryTest( '[session-mode] replay event should not contain an error id of a dropped error while recording', - async ({ getLocalTestUrl, page, forceFlushReplay, browserName }) => { + async ({ getLocalTestPath, page, forceFlushReplay, browserName }) => { // Skipping this in webkit because it is flakey there if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -94,7 +94,7 @@ sentryTest( const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await reqPromise0; diff --git a/dev-packages/browser-integration-tests/suites/replay/eventBufferError/test.ts b/dev-packages/browser-integration-tests/suites/replay/eventBufferError/test.ts index e9aeaef406c8..0502cf8fdcc7 100644 --- a/dev-packages/browser-integration-tests/suites/replay/eventBufferError/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/eventBufferError/test.ts @@ -14,12 +14,12 @@ import { sentryTest( 'should stop recording when running into eventBuffer error', - async ({ getLocalTestUrl, page, forceFlushReplay }) => { + async ({ getLocalTestPath, page, forceFlushReplay }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await waitForReplayRequest(page); diff --git a/dev-packages/browser-integration-tests/suites/replay/exceptions/test.ts b/dev-packages/browser-integration-tests/suites/replay/exceptions/test.ts index 972ce990657f..203550d55759 100644 --- a/dev-packages/browser-integration-tests/suites/replay/exceptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/exceptions/test.ts @@ -3,12 +3,12 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { shouldSkipReplayTest } from '../../../utils/replayHelpers'; -sentryTest('exceptions within rrweb and re-thrown and annotated', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('exceptions within rrweb and re-thrown and annotated', async ({ getLocalTestPath, page, browserName }) => { if (shouldSkipReplayTest() || browserName !== 'chromium') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/fileInput/test.ts b/dev-packages/browser-integration-tests/suites/replay/fileInput/test.ts index 0f41dade44f4..153ec956fa4b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/fileInput/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/fileInput/test.ts @@ -18,7 +18,7 @@ function isInputMutation( sentryTest( 'should not capture file input mutations', - async ({ forceFlushReplay, getLocalTestUrl, page, browserName }) => { + async ({ forceFlushReplay, getLocalTestPath, page, browserName }) => { // This seems to be flaky on webkit, so skipping there if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -26,7 +26,7 @@ sentryTest( const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/flushing/test.ts b/dev-packages/browser-integration-tests/suites/replay/flushing/test.ts index 959663a86fa0..52d72fb9a58a 100644 --- a/dev-packages/browser-integration-tests/suites/replay/flushing/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/flushing/test.ts @@ -12,7 +12,7 @@ import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../. * assert on the flush timestamps. Therefore we only assert that events were eventually * sent (i.e. flushed). */ -sentryTest('replay events are flushed after max flush delay was reached', async ({ getLocalTestUrl, page }) => { +sentryTest('replay events are flushed after max flush delay was reached', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -21,7 +21,7 @@ sentryTest('replay events are flushed after max flush delay was reached', async const reqPromise1 = waitForReplayRequest(page, 1); const reqPromise2 = waitForReplayRequest(page, 2); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const replayEvent0 = getReplayEvent(await reqPromise0); diff --git a/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/test.ts b/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/test.ts index d06af4302d30..d23bfafea394 100644 --- a/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/test.ts @@ -3,14 +3,14 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { getCustomRecordingEvents, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('captures keyboard events', async ({ forceFlushReplay, getLocalTestUrl, page }) => { +sentryTest('captures keyboard events', async ({ forceFlushReplay, getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await reqPromise0; diff --git a/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/test.ts b/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/test.ts index f15b154aeb1a..07f5362f4f7b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/test.ts @@ -5,12 +5,12 @@ import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } sentryTest( 'handles large mutations with default options', - async ({ getLocalTestUrl, page, forceFlushReplay, browserName }) => { + async ({ getLocalTestPath, page, forceFlushReplay, browserName }) => { if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); // We have to click in order to ensure the LCP is generated, leading to consistent results async function gotoPageAndClick() { diff --git a/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/test.ts b/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/test.ts index d31ce907f836..d86617396cf6 100644 --- a/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/test.ts @@ -10,12 +10,12 @@ import { sentryTest( 'handles large mutations by stopping replay when `mutationLimit` configured', - async ({ getLocalTestUrl, page, forceFlushReplay, browserName }) => { + async ({ getLocalTestPath, page, forceFlushReplay, browserName }) => { if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); // We have to click in order to ensure the LCP is generated, leading to consistent results async function gotoPageAndClick() { diff --git a/dev-packages/browser-integration-tests/suites/replay/logger/test.ts b/dev-packages/browser-integration-tests/suites/replay/logger/test.ts index 684709819e85..e194c80f05c4 100644 --- a/dev-packages/browser-integration-tests/suites/replay/logger/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/logger/test.ts @@ -3,7 +3,7 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('should output logger messages', async ({ getLocalTestUrl, page }) => { +sentryTest('should output logger messages', async ({ getLocalTestPath, page }) => { // In minified bundles we do not have logger messages, so we skip the test if (shouldSkipReplayTest() || (process.env.PW_BUNDLE || '').includes('_min')) { sentryTest.skip(); @@ -17,7 +17,7 @@ sentryTest('should output logger messages', async ({ getLocalTestUrl, page }) => const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await Promise.all([page.goto(url), reqPromise0]); diff --git a/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/test.ts b/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/test.ts index dcfb69f2d7a2..538cc5f3aa20 100644 --- a/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/test.ts @@ -6,7 +6,7 @@ import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../. const MAX_REPLAY_DURATION = 2000; -sentryTest('keeps track of max duration across reloads', async ({ getLocalTestUrl, page }) => { +sentryTest('keeps track of max duration across reloads', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -14,7 +14,7 @@ sentryTest('keeps track of max duration across reloads', async ({ getLocalTestUr const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/test.ts b/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/test.ts index 6578c5d90183..967de1ecfe0f 100644 --- a/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/test.ts @@ -6,7 +6,7 @@ import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../. const MIN_DURATION = 2000; -sentryTest('doest not send replay before min. duration', async ({ getLocalTestUrl, page }) => { +sentryTest('doest not send replay before min. duration', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -17,7 +17,7 @@ sentryTest('doest not send replay before min. duration', async ({ getLocalTestUr return true; }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyBlock/test.ts b/dev-packages/browser-integration-tests/suites/replay/privacyBlock/test.ts index 2c464c4575b4..a6f40d884e8b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyBlock/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/privacyBlock/test.ts @@ -8,14 +8,14 @@ import { waitForReplayRequest, } from '../../../utils/replayHelpers'; -sentryTest('should allow to manually block elements', async ({ getLocalTestUrl, page }) => { +sentryTest('should allow to manually block elements', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const snapshots = getFullRecordingSnapshots(await reqPromise0); diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyDefault/test.ts b/dev-packages/browser-integration-tests/suites/replay/privacyDefault/test.ts index 6fa046d6b103..75ba5d2831c6 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyDefault/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/privacyDefault/test.ts @@ -8,14 +8,14 @@ import { waitForReplayRequest, } from '../../../utils/replayHelpers'; -sentryTest('should have the correct default privacy settings', async ({ getLocalTestUrl, page }) => { +sentryTest('should have the correct default privacy settings', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyInput/test.ts b/dev-packages/browser-integration-tests/suites/replay/privacyInput/test.ts index 4ebe4fee009b..19dddd68ec0c 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyInput/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/privacyInput/test.ts @@ -19,7 +19,7 @@ function isInputMutation( sentryTest( 'should mask input initial value and its changes', - async ({ browserName, forceFlushReplay, getLocalTestUrl, page }) => { + async ({ browserName, forceFlushReplay, getLocalTestPath, page }) => { // TODO(replay): This is flakey on webkit (~1%) where we do not always get the latest mutation. if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -54,7 +54,7 @@ sentryTest( return inputMutationSegmentIds.length === 2 && inputMutationSegmentIds[1] < event.segment_id; }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); @@ -84,7 +84,7 @@ sentryTest( sentryTest( 'should mask textarea initial value and its changes', - async ({ browserName, forceFlushReplay, getLocalTestUrl, page }) => { + async ({ browserName, forceFlushReplay, getLocalTestPath, page }) => { // TODO(replay): This is flakey on webkit (~1%) where we do not always get the latest mutation. if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -131,7 +131,7 @@ sentryTest( return check; }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const fullSnapshot = getFullRecordingSnapshots(await reqPromise0); diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/test.ts b/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/test.ts index f5d36f6f5017..7d64cd839d22 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/test.ts @@ -19,7 +19,7 @@ function isInputMutation( sentryTest( 'should mask input initial value and its changes from `maskAllInputs` and allow unmasked selector', - async ({ browserName, forceFlushReplay, getLocalTestUrl, page }) => { + async ({ browserName, forceFlushReplay, getLocalTestPath, page }) => { // TODO(replay): This is flakey on webkit (~1%) where we do not always get the latest mutation. if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -46,7 +46,7 @@ sentryTest( ); }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); @@ -75,7 +75,7 @@ sentryTest( sentryTest( 'should mask textarea initial value and its changes from `maskAllInputs` and allow unmasked selector', - async ({ browserName, forceFlushReplay, getLocalTestUrl, page }) => { + async ({ browserName, forceFlushReplay, getLocalTestPath, page }) => { // TODO(replay): This is flakey on webkit (~1%) where we do not always get the latest mutation. if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -102,7 +102,7 @@ sentryTest( ); }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts b/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts index a5f10c18d83f..7eb84f7da310 100644 --- a/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts @@ -4,7 +4,7 @@ import { sentryTest } from '../../../utils/fixtures'; sentryTest( 'exports a shim replayIntegration integration for non-replay bundles', - async ({ getLocalTestUrl, page, forceFlushReplay }) => { + async ({ getLocalTestPath, page, forceFlushReplay }) => { const bundle = process.env.PW_BUNDLE; if (!bundle || !bundle.startsWith('bundle_') || bundle.includes('replay')) { @@ -24,7 +24,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts b/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts index 7df2ab111f3f..8d3b7bab9aa0 100644 --- a/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts @@ -4,7 +4,7 @@ import { sentryTest } from '../../../utils/fixtures'; sentryTest( 'exports a shim Replay integration for non-replay bundles', - async ({ getLocalTestUrl, page, forceFlushReplay }) => { + async ({ getLocalTestPath, page, forceFlushReplay }) => { const bundle = process.env.PW_BUNDLE; if (!bundle || !bundle.startsWith('bundle_') || bundle.includes('replay')) { @@ -24,7 +24,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await forceFlushReplay(); diff --git a/dev-packages/browser-integration-tests/suites/replay/requests/test.ts b/dev-packages/browser-integration-tests/suites/replay/requests/test.ts index efb344382b69..eedfb5ae5fb2 100644 --- a/dev-packages/browser-integration-tests/suites/replay/requests/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/requests/test.ts @@ -4,7 +4,7 @@ import { sentryTest } from '../../../utils/fixtures'; import { expectedFetchPerformanceSpan, expectedXHRPerformanceSpan } from '../../../utils/replayEventTemplates'; import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers'; -sentryTest('replay recording should contain fetch request span', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('replay recording should contain fetch request span', async ({ getLocalTestPath, page, browserName }) => { // Possibly related: https://github.com/microsoft/playwright/issues/11390 if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); @@ -21,7 +21,7 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const [req0] = await Promise.all([reqPromise0, page.goto(url), page.locator('#go-background').click()]); @@ -35,7 +35,7 @@ sentryTest('replay recording should contain fetch request span', async ({ getLoc expect(performanceSpans).toContainEqual(expectedFetchPerformanceSpan); }); -sentryTest('replay recording should contain XHR request span', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('replay recording should contain XHR request span', async ({ getLocalTestPath, page, browserName }) => { if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); } @@ -51,7 +51,7 @@ sentryTest('replay recording should contain XHR request span', async ({ getLocal const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const [req0] = await Promise.all([reqPromise0, page.goto(url), page.locator('#go-background').click()]); diff --git a/dev-packages/browser-integration-tests/suites/replay/sampling/test.ts b/dev-packages/browser-integration-tests/suites/replay/sampling/test.ts index be9fd3150cda..cc68be486749 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sampling/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/sampling/test.ts @@ -3,7 +3,7 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../utils/fixtures'; import { getReplaySnapshot, shouldSkipReplayTest } from '../../../utils/replayHelpers'; -sentryTest('should not send replays if both sample rates are 0', async ({ getLocalTestUrl, page }) => { +sentryTest('should not send replays if both sample rates are 0', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -19,7 +19,7 @@ sentryTest('should not send replays if both sample rates are 0', async ({ getLoc }); }); - const url = await getLocalTestUrl({ testDir: __dirname, skipDsnRouteHandler: true }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); await page.locator('button').click(); diff --git a/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/test.ts b/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/test.ts index 79c7758ec099..49a95345fc43 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/test.ts @@ -14,7 +14,7 @@ import { // Session should expire after 2s - keep in sync with init.js const SESSION_TIMEOUT = 2000; -sentryTest('handles an expired session', async ({ browserName, forceFlushReplay, getLocalTestUrl, page }) => { +sentryTest('handles an expired session', async ({ browserName, forceFlushReplay, getLocalTestPath, page }) => { if (shouldSkipReplayTest() || browserName === 'webkit') { sentryTest.skip(); } @@ -22,7 +22,7 @@ sentryTest('handles an expired session', async ({ browserName, forceFlushReplay, const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const req0 = await reqPromise0; diff --git a/dev-packages/browser-integration-tests/suites/replay/sessionInactive/test.ts b/dev-packages/browser-integration-tests/suites/replay/sessionInactive/test.ts index 2f346c05962f..0ac765c3a969 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sessionInactive/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/sessionInactive/test.ts @@ -14,7 +14,7 @@ import { // Session should be paused after 2s - keep in sync with init.js const SESSION_PAUSED = 2000; -sentryTest('handles an inactive session', async ({ getLocalTestUrl, page, browserName }) => { +sentryTest('handles an inactive session', async ({ getLocalTestPath, page, browserName }) => { // webkit is a bit flakey here, the ids are sometimes off by , so seems like there is a race condition with checkout? if (shouldSkipReplayTest() || browserName === 'webkit') { @@ -23,7 +23,7 @@ sentryTest('handles an inactive session', async ({ getLocalTestUrl, page, browse const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const req0 = await reqPromise0; diff --git a/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/test.ts b/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/test.ts index 92c917562ec4..d658f407009c 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/test.ts @@ -18,7 +18,7 @@ const MAX_REPLAY_DURATION = 4000; The main difference between this and sessionExpiry test, is that here we wait for the overall time (4s) in multiple steps (2s, 2s) instead of waiting for the whole time at once (4s). */ -sentryTest('handles session that exceeds max age', async ({ forceFlushReplay, getLocalTestUrl, page }) => { +sentryTest('handles session that exceeds max age', async ({ forceFlushReplay, getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } @@ -26,7 +26,7 @@ sentryTest('handles session that exceeds max age', async ({ forceFlushReplay, ge const reqPromise0 = waitForReplayRequest(page, 0); const reqPromise1 = waitForReplayRequest(page, 1); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts b/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts index 475453f6b3f0..1928bfcf2c2e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/ignore/test.ts @@ -86,44 +86,3 @@ sentryTest('click is ignored on div', async ({ getLocalTestUrl, page }) => { }, ]); }); - -sentryTest('click is ignored on input file by default', async ({ getLocalTestUrl, page }) => { - if (shouldSkipReplayTest()) { - sentryTest.skip(); - } - - const url = await getLocalTestUrl({ testDir: __dirname }); - - await Promise.all([waitForReplayRequest(page, 0), page.goto(url)]); - - const [req1] = await Promise.all([ - waitForReplayRequest(page, (event, res) => { - const { breadcrumbs } = getCustomRecordingEvents(res); - - return breadcrumbs.some(breadcrumb => breadcrumb.category === 'ui.click'); - }), - page.locator('#inputFile').click(), - ]); - - const { breadcrumbs } = getCustomRecordingEvents(req1); - - expect(breadcrumbs).toEqual([ - { - category: 'ui.click', - data: { - node: { - attributes: { - id: 'inputFile', - }, - id: expect.any(Number), - tagName: 'input', - textContent: '', - }, - nodeId: expect.any(Number), - }, - message: 'body > input#inputFile[type="file"]', - timestamp: expect.any(Number), - type: 'default', - }, - ]); -}); diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html b/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html index a3f5d9d54882..45cc78aef02e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/template.html @@ -1,4 +1,4 @@ - + @@ -27,7 +27,6 @@ -

Heading

diff --git a/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/test.ts b/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/test.ts index 3e362b38d49a..fd8250fe86ad 100644 --- a/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/test.ts @@ -8,14 +8,14 @@ import { waitForReplayRequest, } from '../../../../utils/replayHelpers'; -sentryTest('replay should handle unicode characters', async ({ getLocalTestUrl, page }) => { +sentryTest('replay should handle unicode characters', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const snapshots = getFullRecordingSnapshots(await reqPromise0); diff --git a/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/test.ts b/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/test.ts index 679f83362ed2..782d44702c34 100644 --- a/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/test.ts @@ -8,14 +8,14 @@ import { waitForReplayRequest, } from '../../../../utils/replayHelpers'; -sentryTest('replay should handle unicode characters', async ({ getLocalTestUrl, page }) => { +sentryTest('replay should handle unicode characters', async ({ getLocalTestPath, page }) => { if (shouldSkipReplayTest()) { sentryTest.skip(); } const reqPromise0 = waitForReplayRequest(page, 0); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const snapshots = getFullRecordingSnapshots(await reqPromise0); diff --git a/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts b/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts index 985977a3f0a5..e140cf14ebea 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts @@ -5,8 +5,8 @@ import type { SessionContext } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; -sentryTest('should start a new session on pageload.', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should start a new session on pageload.', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const session = await getFirstSentryEnvelopeRequest(page, url); expect(session).toBeDefined(); diff --git a/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts b/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts index 8a8243d81257..6dffb1f85902 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts @@ -5,8 +5,8 @@ import type { SessionContext } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; -sentryTest('should start a new session on pageload.', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should start a new session on pageload.', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const session = await getFirstSentryEnvelopeRequest(page, url); expect(session).toBeDefined(); diff --git a/dev-packages/browser-integration-tests/suites/sessions/update-session/test.ts b/dev-packages/browser-integration-tests/suites/sessions/update-session/test.ts index 966b133dded1..422d716db9e6 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/update-session/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/update-session/test.ts @@ -4,8 +4,8 @@ import type { SessionContext } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; -sentryTest('should update session when an error is thrown.', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should update session when an error is thrown.', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const pageloadSession = await getFirstSentryEnvelopeRequest(page, url); const updatedSession = ( await Promise.all([page.locator('#throw-error').click(), getFirstSentryEnvelopeRequest(page)]) @@ -21,8 +21,8 @@ sentryTest('should update session when an error is thrown.', async ({ getLocalTe expect(pageloadSession.sid).toBe(updatedSession.sid); }); -sentryTest('should update session when an exception is captured.', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should update session when an exception is captured.', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const pageloadSession = await getFirstSentryEnvelopeRequest(page, url); const updatedSession = ( diff --git a/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts b/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts index 8a8243d81257..6dffb1f85902 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts @@ -5,8 +5,8 @@ import type { SessionContext } from '@sentry/types'; import { sentryTest } from '../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; -sentryTest('should start a new session on pageload.', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should start a new session on pageload.', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const session = await getFirstSentryEnvelopeRequest(page, url); expect(session).toBeDefined(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans/test.ts index c9ffb2580615..b79483149fd1 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/async-spans/test.ts @@ -11,12 +11,12 @@ type WindowWithSpan = Window & { sentryTest( 'async spans with different durations lead to unexpected behavior in browser (no "asynchronous context tracking")', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); const envelope = await getFirstSentryEnvelopeRequest(page); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-custom/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-custom/test.ts index 2997f614aa26..1e56b405f579 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-custom/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-custom/test.ts @@ -4,12 +4,12 @@ import type { SpanJSON } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should finish a custom transaction when the page goes background', async ({ getLocalTestUrl, page }) => { +sentryTest('should finish a custom transaction when the page goes background', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await page.locator('#start-span').click(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-pageload/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-pageload/test.ts index 0dcd11ee0159..1feda2e850e5 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-pageload/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-pageload/test.ts @@ -4,11 +4,11 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should finish pageload transaction when the page goes background', async ({ getLocalTestUrl, page }) => { +sentryTest('should finish pageload transaction when the page goes background', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await page.locator('#go-background').click(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts index 3dbc9a90307c..7eaab8b2872e 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/error/test.ts @@ -9,7 +9,7 @@ import { sentryTest( 'should put the pageload transaction name onto an error event caught during pageload', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (browserName === 'webkit') { // This test fails on Webkit as errors thrown from `runScriptInSandbox` are Script Errors and skipped by Sentry sentryTest.skip(); @@ -19,7 +19,7 @@ sentryTest( sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts index 8d6e9124a86e..a8e7f9eec335 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts @@ -4,7 +4,7 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should create fetch spans with http timing @firefox', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should create fetch spans with http timing @firefox', async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium', 'firefox']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { @@ -21,7 +21,7 @@ sentryTest('should create fetch spans with http timing @firefox', async ({ brows }); }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const envelopes = await getMultipleSentryEnvelopeRequests(page, 2, { url, timeout: 10000 }); const tracingEvent = envelopes[envelopes.length - 1]; // last envelope contains tracing data on all browsers diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions/test.ts index 0bf03d3576ff..4ebea3457af6 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions/test.ts @@ -8,13 +8,13 @@ import { shouldSkipTracingTest, } from '../../../../utils/helpers'; -sentryTest('should capture interaction transaction. @firefox', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture interaction transaction. @firefox', async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium', 'firefox']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); @@ -49,14 +49,14 @@ sentryTest('should capture interaction transaction. @firefox', async ({ browserN sentryTest( 'should create only one transaction per interaction @firefox', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium', 'firefox']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); @@ -73,14 +73,14 @@ sentryTest( sentryTest( 'should use the component name for a clicked element when it is available', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium', 'firefox']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); @@ -103,14 +103,14 @@ sentryTest( sentryTest( 'should use the element name for a clicked element when no component name', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium', 'firefox']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-before-navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-before-navigation/test.ts index a4804d0ff309..e6fb88232d63 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-before-navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-before-navigation/test.ts @@ -6,13 +6,13 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. sentryTest( "doesn't capture long animation frame that starts before a navigation.", - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long animation frames only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-disabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-disabled/test.ts index a0a263762186..2527d5a67302 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-disabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-disabled/test.ts @@ -7,7 +7,7 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. sentryTest( 'should not capture long animation frame when flag is disabled.', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long animation frames only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -17,7 +17,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/script.js` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts index b2729a70f4cf..850e75dbed1f 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts @@ -8,7 +8,7 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. sentryTest( 'should capture long animation frame for top-level script.', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long animation frames only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -18,7 +18,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/script.js` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const promise = getFirstSentryEnvelopeRequest(page); @@ -30,11 +30,9 @@ sentryTest( const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame')); - expect(uiSpans?.length).toBeGreaterThanOrEqual(1); + expect(uiSpans?.length).toEqual(1); - const topLevelUISpan = (uiSpans || []).find( - span => span.data?.['browser.script.invoker'] === 'https://example.com/path/to/script.js', - )!; + const [topLevelUISpan] = uiSpans || []; expect(topLevelUISpan).toEqual( expect.objectContaining({ op: 'ui.long-animation-frame', @@ -61,7 +59,7 @@ sentryTest( sentryTest( 'should capture long animation frame for event listener.', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long animation frames only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -71,7 +69,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/script.js` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const promise = getFirstSentryEnvelopeRequest(page); @@ -86,11 +84,10 @@ sentryTest( const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame')); - expect(uiSpans?.length).toBeGreaterThanOrEqual(2); + expect(uiSpans?.length).toEqual(2); - const eventListenerUISpan = (uiSpans || []).find( - span => span.data?.['browser.script.invoker'] === 'BUTTON#clickme.onclick', - )!; + // ignore the first ui span (top-level long animation frame) + const [, eventListenerUISpan] = uiSpans || []; expect(eventListenerUISpan).toEqual( expect.objectContaining({ diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-non-chromium/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-non-chromium/test.ts index 56d0456e9a2a..65fb6664ac82 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-non-chromium/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-non-chromium/test.ts @@ -7,7 +7,7 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. sentryTest( 'should not capture long animation frame or long task when browser is non-chromium', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Only test non-chromium browsers if (shouldSkipTracingTest() || browserName === 'chromium') { sentryTest.skip(); @@ -17,7 +17,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/script.js` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts index a3ad1e98a069..1949e44bd398 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts @@ -8,7 +8,7 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. sentryTest( 'should capture long animation frame for top-level script.', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long animation frames only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -20,7 +20,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/script.js` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const promise = getFirstSentryEnvelopeRequest(page); @@ -32,11 +32,9 @@ sentryTest( const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame')); - expect(uiSpans?.length).toBeGreaterThanOrEqual(1); + expect(uiSpans?.length).toEqual(1); - const topLevelUISpan = (uiSpans || []).find( - span => span.data?.['browser.script.invoker'] === 'https://example.com/path/to/script.js', - )!; + const [topLevelUISpan] = uiSpans || []; expect(topLevelUISpan).toEqual( expect.objectContaining({ op: 'ui.long-animation-frame', @@ -63,7 +61,7 @@ sentryTest( sentryTest( 'should capture long animation frame for event listener.', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long animation frames only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -73,7 +71,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/script.js` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const promise = getFirstSentryEnvelopeRequest(page); @@ -88,11 +86,10 @@ sentryTest( const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame')); - expect(uiSpans?.length).toBeGreaterThanOrEqual(2); + expect(uiSpans?.length).toEqual(2); - const eventListenerUISpan = (uiSpans || []).find( - span => span.data?.['browser.script.invoker'] === 'BUTTON#clickme.onclick', - )!; + // ignore the first ui span (top-level long animation frame) + const [, eventListenerUISpan] = uiSpans || []; expect(eventListenerUISpan).toEqual( expect.objectContaining({ diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/test.ts index a2ac2817b853..d7504eba840c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-before-navigation/test.ts @@ -6,12 +6,12 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. sentryTest( "doesn't capture long task spans starting before a navigation in the navigation transaction", - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // Long tasks only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/test.ts index 47d212e44119..6dab208d1c4e 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-disabled/test.ts @@ -5,7 +5,7 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should not capture long task when flag is disabled.', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should not capture long task when flag is disabled.', async ({ browserName, getLocalTestPath, page }) => { // Long tasks only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -13,7 +13,7 @@ sentryTest('should not capture long task when flag is disabled.', async ({ brows await page.route('**/path/to/script.js', (route: Route) => route.fulfill({ path: `${__dirname}/assets/script.js` })); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/test.ts index e0c655836561..6189758c0340 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-enabled/test.ts @@ -5,7 +5,7 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should capture long task.', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture long task.', async ({ browserName, getLocalTestPath, page }) => { // Long tasks only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -13,7 +13,7 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestUrl, p await page.route('**/path/to/script.js', (route: Route) => route.fulfill({ path: `${__dirname}/assets/script.js` })); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-no-animation-frame/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-no-animation-frame/test.ts index e0c655836561..6189758c0340 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-no-animation-frame/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-no-animation-frame/test.ts @@ -5,7 +5,7 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should capture long task.', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture long task.', async ({ browserName, getLocalTestPath, page }) => { // Long tasks only work on chrome if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -13,7 +13,7 @@ sentryTest('should capture long task.', async ({ browserName, getLocalTestUrl, p await page.route('**/path/to/script.js', (route: Route) => route.fulfill({ path: `${__dirname}/assets/script.js` })); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/test.ts index b33ea0cc444c..ae89fd383cbb 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/test.ts @@ -8,32 +8,35 @@ import { shouldSkipTracingTest, } from '../../../../utils/helpers'; -sentryTest('should create a pageload transaction based on `sentry-trace` ', async ({ getLocalTestUrl, page }) => { - if (shouldSkipTracingTest()) { - sentryTest.skip(); - } +sentryTest( + 'should create a pageload transaction based on `sentry-trace` ', + async ({ getLocalTestPath, page }) => { + if (shouldSkipTracingTest()) { + sentryTest.skip(); + } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); - const eventData = await getFirstSentryEnvelopeRequest(page, url); + const eventData = await getFirstSentryEnvelopeRequest(page, url); - expect(eventData.contexts?.trace).toMatchObject({ - op: 'pageload', - parent_span_id: '1121201211212012', - trace_id: '12312012123120121231201212312012', - }); + expect(eventData.contexts?.trace).toMatchObject({ + op: 'pageload', + parent_span_id: '1121201211212012', + trace_id: '12312012123120121231201212312012', + }); - expect(eventData.spans?.length).toBeGreaterThan(0); -}); + expect(eventData.spans?.length).toBeGreaterThan(0); + }, +); sentryTest( 'should pick up `baggage` tag, propagate the content in transaction and not add own data', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const envHeader = await getFirstSentryEnvelopeRequest(page, url, envelopeHeaderRequestParser); @@ -49,12 +52,12 @@ sentryTest( sentryTest( "should create a navigation that's not influenced by `sentry-trace` ", - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const pageloadRequest = await getFirstSentryEnvelopeRequest(page, url); const navigationRequest = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts index 59939b0a6973..5a46a65a4392 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should create a navigation transaction on page navigation', async ({ getLocalTestUrl, page }) => { +sentryTest('should create a navigation transaction on page navigation', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const pageloadRequest = await getFirstSentryEnvelopeRequest(page, url); const navigationRequest = await getFirstSentryEnvelopeRequest(page, `${url}#foo`); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts index 14a95ed9e29e..ff47f1a2d238 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-update-txn-name/test.ts @@ -10,12 +10,12 @@ import { import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('sets the source to custom when updating the transaction name', async ({ getLocalTestUrl, page }) => { +sentryTest('sets the source to custom when updating the transaction name', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts index 6f855168ebce..70f719d8dbbf 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload/test.ts @@ -10,12 +10,12 @@ import { import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('creates a pageload transaction with url as source', async ({ getLocalTestUrl, page }) => { +sentryTest('creates a pageload transaction with url as source', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const timeOrigin = await page.evaluate('window._testBaseTimestamp'); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadDelayed/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadDelayed/test.ts index e0adc33e6271..882c08d23c5e 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadDelayed/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageloadDelayed/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should create a pageload transaction when initialized delayed', async ({ getLocalTestUrl, page }) => { +sentryTest('should create a pageload transaction when initialized delayed', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const timeOrigin = await page.evaluate('window._testBaseTimestamp'); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/customTargets/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/customTargets/test.ts index 499b81e966d1..fb6e9e540c46 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/customTargets/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/customTargets/test.ts @@ -5,12 +5,12 @@ import { shouldSkipTracingTest } from '../../../../../utils/helpers'; sentryTest( 'should attach `sentry-trace` and `baggage` header to request matching tracePropagationTargets', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/defaultTargetsNoMatch/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/defaultTargetsNoMatch/test.ts index a56c99ece38b..0f7323d484e7 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/defaultTargetsNoMatch/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/tracePropagationTargets/defaultTargetsNoMatch/test.ts @@ -5,12 +5,12 @@ import { shouldSkipTracingTest } from '../../../../../utils/helpers'; sentryTest( 'should not attach `sentry-trace` and `baggage` header to cross-origin requests when no tracePropagationTargets are defined', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/init.js b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/init.js index 3595ea724749..d7cfd52aedcc 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/init.js +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/init.js @@ -7,3 +7,6 @@ Sentry.init({ sampleRate: 1, integrations: [Sentry.browserTracingIntegration()], }); + +// This should not fail +Sentry.addTracingExtensions(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/test.ts index 4d98663933bd..b55a5fef4d98 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegrationShim/test.ts @@ -5,7 +5,7 @@ import { shouldSkipTracingTest } from '../../../utils/helpers'; sentryTest( 'exports a shim browserTracingIntegration() integration for non-tracing bundles', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { // Skip in tracing tests if (!shouldSkipTracingTest()) { sentryTest.skip(); @@ -24,11 +24,7 @@ sentryTest( }); }); - const url = await getLocalTestUrl({ - testDir: __dirname, - skipDsnRouteHandler: true, - handleLazyLoadedFeedback: true, - }); + const url = await getLocalTestPath({ testDir: __dirname, skipDsnRouteHandler: true }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts b/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts index f2f4b10ede46..6126a6728ca5 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts @@ -10,12 +10,12 @@ import { sentryTest( 'should only include transaction name if source is better than an unparameterized URL', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const envHeader = await getFirstSentryEnvelopeRequest(page, url, envelopeHeaderRequestParser); diff --git a/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts b/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts index fdfbac823166..6df352af5fc0 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts @@ -10,12 +10,12 @@ import { sentryTest( 'should send dynamic sampling context data in trace envelope header of a transaction envelope', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const envHeader = await getFirstSentryEnvelopeRequest(page, url, envelopeHeaderRequestParser); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/connection-rtt/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/connection-rtt/test.ts index 145c718dd151..4dbb8f186d42 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/connection-rtt/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/connection-rtt/test.ts @@ -23,8 +23,8 @@ async function createSessionWithLatency(page: Page, latency: number) { return session; } -sentryTest('should capture a `connection.rtt` metric.', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a `connection.rtt` metric.', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); expect(eventData.measurements).toBeDefined(); @@ -33,10 +33,10 @@ sentryTest('should capture a `connection.rtt` metric.', async ({ getLocalTestUrl sentryTest( 'should capture a `connection.rtt` metric with emulated value 200ms on Chromium.', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { const session = await createSessionWithLatency(page, 200); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); await session.detach(); @@ -48,10 +48,10 @@ sentryTest( sentryTest( 'should capture a `connection.rtt` metric with emulated value 100ms on Chromium.', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { const session = await createSessionWithLatency(page, 100); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); await session.detach(); @@ -63,10 +63,10 @@ sentryTest( sentryTest( 'should capture a `connection.rtt` metric with emulated value 50ms on Chromium.', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { const session = await createSessionWithLatency(page, 50); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); await session.detach(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts index 78b48dc5a7f5..75f09e12e53d 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts @@ -9,7 +9,7 @@ const bundle = process.env.PW_BUNDLE || ''; sentryTest( 'should capture metrics for LCP instrumentation handlers', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { // This uses a utility that is not exported in CDN bundles if (shouldSkipTracingTest() || browserName !== 'chromium' || bundle.startsWith('bundle')) { sentryTest.skip(); @@ -19,7 +19,7 @@ sentryTest( route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` }), ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const [eventData] = await Promise.all([ getFirstSentryEnvelopeRequest(page), diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts index 3fb942f4aa67..90660de34ded 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-browser-spans/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should add browser-related spans to pageload transaction', async ({ getLocalTestUrl, page }) => { +sentryTest('should add browser-related spans to pageload transaction', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const browserSpans = eventData.spans?.filter(({ op }) => op?.startsWith('browser')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts index 7f2e2fae9021..c53993cba21d 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-measure-spans/test.ts @@ -5,12 +5,12 @@ import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; // Validation test for https://github.com/getsentry/sentry-javascript/issues/12281 -sentryTest('should add browser-related spans to pageload transaction', async ({ getLocalTestUrl, page }) => { +sentryTest('should add browser-related spans to pageload transaction', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const browserSpans = eventData.spans?.filter(({ op }) => op?.startsWith('browser')); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts index b27d747df649..6defe804e665 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts @@ -41,7 +41,7 @@ function hidePage(page: Page): Promise { }); } -sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', async ({ getLocalTestUrl, page }) => { +sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', async ({ getLocalTestPath, page }) => { const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( page, 1, @@ -49,7 +49,7 @@ sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', a properFullEnvelopeRequestParser, ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(`${url}#0.05`); await waitForLayoutShift(page); @@ -105,7 +105,7 @@ sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', a }); }); -sentryTest('captures a "MEH" CLS vital with its source as a standalone span', async ({ getLocalTestUrl, page }) => { +sentryTest('captures a "MEH" CLS vital with its source as a standalone span', async ({ getLocalTestPath, page }) => { const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( page, 1, @@ -113,7 +113,7 @@ sentryTest('captures a "MEH" CLS vital with its source as a standalone span', as properFullEnvelopeRequestParser, ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(`${url}#0.21`); await waitForLayoutShift(page); @@ -172,7 +172,7 @@ sentryTest('captures a "MEH" CLS vital with its source as a standalone span', as }); }); -sentryTest('captures a "POOR" CLS vital with its source as a standalone span.', async ({ getLocalTestUrl, page }) => { +sentryTest('captures a "POOR" CLS vital with its source as a standalone span.', async ({ getLocalTestPath, page }) => { const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( page, 1, @@ -180,7 +180,7 @@ sentryTest('captures a "POOR" CLS vital with its source as a standalone span.', properFullEnvelopeRequestParser, ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(`${url}#0.35`); await waitForLayoutShift(page); @@ -239,7 +239,7 @@ sentryTest('captures a "POOR" CLS vital with its source as a standalone span.', sentryTest( 'captures a 0 CLS vital as a standalone span if no layout shift occurred', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( page, 1, @@ -247,7 +247,7 @@ sentryTest( properFullEnvelopeRequestParser, ); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await page.waitForTimeout(1000); @@ -302,8 +302,8 @@ sentryTest( sentryTest( 'captures CLS increases after the pageload span ended, when page is hidden', - async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); + async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); @@ -339,8 +339,8 @@ sentryTest( }, ); -sentryTest('sends CLS of the initial page when soft-navigating to a new page', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('sends CLS of the initial page when soft-navigating to a new page', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); @@ -366,8 +366,8 @@ sentryTest('sends CLS of the initial page when soft-navigating to a new page', a expect(spanEnvelopeItem.data?.['sentry.pageload.span_id']).toMatch(/[a-f0-9]{16}/); }); -sentryTest("doesn't send further CLS after the first navigation", async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest("doesn't send further CLS after the first navigation", async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); @@ -410,8 +410,8 @@ sentryTest("doesn't send further CLS after the first navigation", async ({ getLo await navigationTxnPromise; }); -sentryTest("doesn't send further CLS after the first page hide", async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest("doesn't send further CLS after the first page hide", async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); @@ -454,8 +454,8 @@ sentryTest("doesn't send further CLS after the first page hide", async ({ getLoc await navigationTxnPromise; }); -sentryTest('CLS span timestamps are set correctly', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('CLS span timestamps are set correctly', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls/test.ts index 64ccba5d9b35..00fc906aa60e 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls/test.ts @@ -12,8 +12,8 @@ sentryTest.beforeEach(async ({ browserName, page }) => { await page.setViewportSize({ width: 800, height: 1200 }); }); -sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, `${url}#0.05`); expect(eventData.measurements).toBeDefined(); @@ -26,8 +26,8 @@ sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ get expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p#partial'); }); -sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, `${url}#0.21`); expect(eventData.measurements).toBeDefined(); @@ -40,8 +40,8 @@ sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getL expect(eventData.contexts?.trace?.data?.['cls.source.1']).toBe('body > div#content > p'); }); -sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); +sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ getLocalTestPath, page }) => { + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, `${url}#0.35`); expect(eventData.measurements).toBeDefined(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fid/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fid/test.ts index 469660563a4e..e70247230b15 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fid/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fid/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should capture a FID vital.', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture a FID vital.', async ({ browserName, getLocalTestPath, page }) => { // FID measurement is not generated on webkit if (shouldSkipTracingTest() || browserName === 'webkit') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); // To trigger FID diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fp-fcp/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fp-fcp/test.ts index bcdf9e232329..70a9fd689e6e 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fp-fcp/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-fp-fcp/test.ts @@ -4,13 +4,13 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should capture FP vital.', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture FP vital.', async ({ browserName, getLocalTestPath, page }) => { // FP is not generated on webkit or firefox if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); expect(eventData.measurements).toBeDefined(); @@ -23,12 +23,12 @@ sentryTest('should capture FP vital.', async ({ browserName, getLocalTestUrl, pa expect(fpSpan?.parent_span_id).toBe(eventData.contexts?.trace?.span_id); }); -sentryTest('should capture FCP vital.', async ({ getLocalTestUrl, page }) => { +sentryTest('should capture FCP vital.', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); expect(eventData.measurements).toBeDefined(); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts index 438c9c5f6ecd..1fee219c8e5b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts @@ -9,14 +9,14 @@ import { shouldSkipTracingTest, } from '../../../../utils/helpers'; -sentryTest('should capture an INP click event span after pageload', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture an INP click event span after pageload', async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); // wait for page load diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts index c68903f23e71..18be7b654140 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts @@ -11,14 +11,14 @@ import { sentryTest( 'should capture an INP click event span after pageload for a parametrized transaction', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); // wait for page load diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts index 4f3c262d780d..bf5021250b42 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts @@ -10,14 +10,14 @@ import { sentryTest( 'should capture an INP click event span during pageload for a parametrized transaction', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts index ab2146185b72..e42028f9dff1 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts @@ -9,96 +9,99 @@ import { shouldSkipTracingTest, } from '../../../../utils/helpers'; -sentryTest('should capture an INP click event span during pageload', async ({ browserName, getLocalTestUrl, page }) => { - const supportedBrowsers = ['chromium']; - - if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { - sentryTest.skip(); - } +sentryTest( + 'should capture an INP click event span during pageload', + async ({ browserName, getLocalTestPath, page }) => { + const supportedBrowsers = ['chromium']; - const url = await getLocalTestUrl({ testDir: __dirname }); + if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { + sentryTest.skip(); + } - await page.goto(url); + const url = await getLocalTestPath({ testDir: __dirname }); - const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( - page, - 1, - { envelopeType: 'span' }, - properFullEnvelopeRequestParser, - ); + await page.goto(url); - await page.locator('[data-test-id=normal-button]').click(); - await page.locator('.clicked[data-test-id=normal-button]').isVisible(); + const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( + page, + 1, + { envelopeType: 'span' }, + properFullEnvelopeRequestParser, + ); - await page.waitForTimeout(500); + await page.locator('[data-test-id=normal-button]').click(); + await page.locator('.clicked[data-test-id=normal-button]').isVisible(); - // Page hide to trigger INP - await page.evaluate(() => { - window.dispatchEvent(new Event('pagehide')); - }); + await page.waitForTimeout(500); - // Get the INP span envelope - const spanEnvelope = (await spanEnvelopePromise)[0]; + // Page hide to trigger INP + await page.evaluate(() => { + window.dispatchEvent(new Event('pagehide')); + }); - const spanEnvelopeHeaders = spanEnvelope[0]; - const spanEnvelopeItem = spanEnvelope[1][0][1]; + // Get the INP span envelope + const spanEnvelope = (await spanEnvelopePromise)[0]; + + const spanEnvelopeHeaders = spanEnvelope[0]; + const spanEnvelopeItem = spanEnvelope[1][0][1]; + + const traceId = spanEnvelopeHeaders.trace!.trace_id; + expect(traceId).toMatch(/[a-f0-9]{32}/); + + expect(spanEnvelopeHeaders).toEqual({ + sent_at: expect.any(String), + trace: { + environment: 'production', + public_key: 'public', + sample_rate: '1', + sampled: 'true', + trace_id: traceId, + // no transaction, because span source is URL + }, + }); - const traceId = spanEnvelopeHeaders.trace!.trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + const inpValue = spanEnvelopeItem.measurements?.inp.value; + expect(inpValue).toBeGreaterThan(0); - expect(spanEnvelopeHeaders).toEqual({ - sent_at: expect.any(String), - trace: { - environment: 'production', - public_key: 'public', - sample_rate: '1', - sampled: 'true', - trace_id: traceId, - // no transaction, because span source is URL - }, - }); - - const inpValue = spanEnvelopeItem.measurements?.inp.value; - expect(inpValue).toBeGreaterThan(0); - - expect(spanEnvelopeItem).toEqual({ - data: { - 'sentry.exclusive_time': inpValue, - 'sentry.op': 'ui.interaction.click', - 'sentry.origin': 'auto.http.browser.inp', - transaction: 'test-url', - 'user_agent.original': expect.stringContaining('Chrome'), - }, - measurements: { - inp: { - unit: 'millisecond', - value: inpValue, + expect(spanEnvelopeItem).toEqual({ + data: { + 'sentry.exclusive_time': inpValue, + 'sentry.op': 'ui.interaction.click', + 'sentry.origin': 'auto.http.browser.inp', + transaction: 'test-url', + 'user_agent.original': expect.stringContaining('Chrome'), }, - }, - description: 'body > NormalButton', - exclusive_time: inpValue, - op: 'ui.interaction.click', - origin: 'auto.http.browser.inp', - segment_id: expect.not.stringMatching(spanEnvelopeItem.span_id!), - // Parent is the pageload span - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), - start_timestamp: expect.any(Number), - timestamp: expect.any(Number), - trace_id: traceId, - }); -}); + measurements: { + inp: { + unit: 'millisecond', + value: inpValue, + }, + }, + description: 'body > NormalButton', + exclusive_time: inpValue, + op: 'ui.interaction.click', + origin: 'auto.http.browser.inp', + segment_id: expect.not.stringMatching(spanEnvelopeItem.span_id!), + // Parent is the pageload span + parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f0-9]{16}/), + start_timestamp: expect.any(Number), + timestamp: expect.any(Number), + trace_id: traceId, + }); + }, +); sentryTest( 'should choose the slowest interaction click event when INP is triggered.', - async ({ browserName, getLocalTestUrl, page }) => { + async ({ browserName, getLocalTestPath, page }) => { const supportedBrowsers = ['chromium']; if (shouldSkipTracingTest() || !supportedBrowsers.includes(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); await getFirstSentryEnvelopeRequest(page); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/template.html b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/template.html index bf7617ea8709..502f4dde80c2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/template.html +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/template.html @@ -6,5 +6,6 @@
+ diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts index 84e93b54ac9b..2e215c728ecf 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts @@ -5,14 +5,7 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -/* - Because we "serve" the html test page as a static file, all requests for the image - are considered 3rd party requests. So the LCP value we obtain for the image is also - considered a 3rd party LCP value, meaning `renderTime` is only set if we also - return the `Timing-Allow-Origin` header. -*/ - -sentryTest('captures LCP vitals with element details.', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('should capture a LCP vital with element details.', async ({ browserName, getLocalTestPath, page }) => { if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); } @@ -22,51 +15,18 @@ sentryTest('captures LCP vitals with element details.', async ({ browserName, ge return route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` }); }); - const url = await getLocalTestUrl({ testDir: __dirname }); - const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest(page), page.goto(url)]); + const url = await getLocalTestPath({ testDir: __dirname }); + const [eventData] = await Promise.all([ + getFirstSentryEnvelopeRequest(page), + page.goto(url), + page.locator('button').click(), + ]); expect(eventData.measurements).toBeDefined(); expect(eventData.measurements?.lcp?.value).toBeDefined(); + // XXX: This should be body > img, but it can be flakey as sometimes it will report + // the button as LCP. expect(eventData.contexts?.trace?.data?.['lcp.element'].startsWith('body >')).toBe(true); expect(eventData.contexts?.trace?.data?.['lcp.size']).toBeGreaterThan(0); - expect(eventData.contexts?.trace?.data?.['lcp.loadTime']).toBeGreaterThan(0); - - // renderTime is 0 because we don't return the `Timing-Allow-Origin` header - // and the image is loaded from a 3rd party origin - expect(eventData.contexts?.trace?.data?.['lcp.renderTime']).toBe(0); - - // The LCP value should be the loadTime because the renderTime is not set - expect(eventData.measurements?.lcp?.value).toBeCloseTo(eventData.contexts?.trace?.data?.['lcp.loadTime']); }); - -sentryTest( - 'captures LCP renderTime when returning Timing-Allow-Origin header.', - async ({ browserName, getLocalTestUrl, page }) => { - if (shouldSkipTracingTest() || browserName !== 'chromium') { - sentryTest.skip(); - } - - page.route('**', route => route.continue()); - page.route('**/my/image.png', async (route: Route) => { - return route.fulfill({ - path: `${__dirname}/assets/sentry-logo-600x179.png`, - headers: { 'Timing-Allow-Origin': '*' }, - }); - }); - - const url = await getLocalTestUrl({ testDir: __dirname }); - const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest(page), page.goto(url)]); - - expect(eventData.measurements).toBeDefined(); - expect(eventData.measurements?.lcp?.value).toBeDefined(); - - expect(eventData.contexts?.trace?.data?.['lcp.element'].startsWith('body >')).toBe(true); - expect(eventData.contexts?.trace?.data?.['lcp.size']).toBeGreaterThan(0); - expect(eventData.contexts?.trace?.data?.['lcp.loadTime']).toBeGreaterThan(0); - expect(eventData.contexts?.trace?.data?.['lcp.renderTime']).toBeGreaterThan(0); - - // The LCP value should be the renderTime because the renderTime is set - expect(eventData.measurements?.lcp?.value).toBeCloseTo(eventData.contexts?.trace?.data?.['lcp.renderTime']); - }, -); diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals/test.ts index c41efad620ac..51a76797a23b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals/test.ts @@ -12,7 +12,7 @@ import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../. * The problem is: We don't always get valid TTFB from the web-vitals library, so we skip the test if that's the case. * Note: There is another test that covers that we actually report TTFB if it is valid (@see ../web-vitals-lcp/test.ts). */ -sentryTest('paint web vitals values are greater than TTFB', async ({ browserName, getLocalTestUrl, page }) => { +sentryTest('paint web vitals values are greater than TTFB', async ({ browserName, getLocalTestPath, page }) => { // Only run in chromium to ensure all vitals are present if (shouldSkipTracingTest() || browserName !== 'chromium') { sentryTest.skip(); @@ -23,7 +23,7 @@ sentryTest('paint web vitals values are greater than TTFB', async ({ browserName return route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` }); }); - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const [eventData] = await Promise.all([ getFirstSentryEnvelopeRequest(page), page.goto(url), @@ -61,13 +61,13 @@ sentryTest('paint web vitals values are greater than TTFB', async ({ browserName sentryTest( 'captures time origin and navigation activationStart as span attributes', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { // Only run in chromium to ensure all vitals are present if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const [eventData] = await Promise.all([getFirstSentryEnvelopeRequest(page), page.goto(url)]); const timeOriginAttribute = eventData.contexts?.trace?.data?.['performance.timeOrigin']; diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-no-tracing/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-no-tracing/test.ts index 56bdc97f7f66..95c7b3052732 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-no-tracing/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-no-tracing/test.ts @@ -5,12 +5,12 @@ import { shouldSkipTracingTest } from '../../../../utils/helpers'; sentryTest( 'should not attach `sentry-trace` header to fetch requests without tracing', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts index 113c1d107454..44911665af7c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts @@ -3,12 +3,12 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should attach `sentry-trace` header to unsampled fetch requests', async ({ getLocalTestUrl, page }) => { +sentryTest('should attach `sentry-trace` header to unsampled fetch requests', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts index bbbed3acb92d..8c5c626731df 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts @@ -5,12 +5,12 @@ import { shouldSkipTracingTest } from '../../../../utils/helpers'; sentryTest( 'should attach `sentry-trace` header to tracing without performance (TWP) fetch requests', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-with-request/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-with-request/test.ts index 3f1a5db07c0f..eb2f354dba4a 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-with-request/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-with-request/test.ts @@ -5,7 +5,7 @@ import { shouldSkipTracingTest } from '../../../../utils/helpers'; sentryTest( 'instrumentation should pass on headers from fetch options instead of init request, if set', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } @@ -25,6 +25,6 @@ sentryTest( }); }); - await getLocalTestUrl({ testDir: __dirname }); + await getLocalTestPath({ testDir: __dirname }); }, ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts index 53ff985a3f1b..6a98022dcdd2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getMultipleSentryEnvelopeRequests, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, page }) => { +sentryTest('should create spans for fetch requests', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); // Because we fetch from http://example.com, fetch will throw a CORS error in firefox and webkit. // Chromium does not throw for cors errors. @@ -43,12 +43,12 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p ); }); -sentryTest('should attach `sentry-trace` header to fetch requests', async ({ getLocalTestUrl, page }) => { +sentryTest('should attach `sentry-trace` header to fetch requests', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-no-tracing/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-no-tracing/test.ts index 56bdc97f7f66..95c7b3052732 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-no-tracing/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-no-tracing/test.ts @@ -5,12 +5,12 @@ import { shouldSkipTracingTest } from '../../../../utils/helpers'; sentryTest( 'should not attach `sentry-trace` header to fetch requests without tracing', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts index cb4149ba27ed..954628873383 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts @@ -3,12 +3,12 @@ import { expect } from '@playwright/test'; import { sentryTest } from '../../../../utils/fixtures'; import { shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should attach `sentry-trace` header to unsampled xhr requests', async ({ getLocalTestUrl, page }) => { +sentryTest('should attach `sentry-trace` header to unsampled xhr requests', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts index f593223d520f..2e1a8ee36277 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts @@ -5,12 +5,12 @@ import { shouldSkipTracingTest } from '../../../../utils/helpers'; sentryTest( 'should attach `sentry-trace` header to tracing without performance (TWP) xhr requests', - async ({ getLocalTestUrl, page }) => { + async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts index 5cc65c872c08..5dbfd3edf4cb 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts @@ -4,12 +4,12 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; -sentryTest('should create spans for XHR requests', async ({ getLocalTestUrl, page }) => { +sentryTest('should create spans for XHR requests', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const eventData = await getFirstSentryEnvelopeRequest(page, url); const requestSpans = eventData.spans?.filter(({ op }) => op === 'http.client'); @@ -35,12 +35,12 @@ sentryTest('should create spans for XHR requests', async ({ getLocalTestUrl, pag ); }); -sentryTest('should attach `sentry-trace` header to XHR requests', async ({ getLocalTestUrl, page }) => { +sentryTest('should attach `sentry-trace` header to XHR requests', async ({ getLocalTestPath, page }) => { if (shouldSkipTracingTest()) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); const requests = ( await Promise.all([ diff --git a/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts b/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts index 4cd9b1e8fdff..2ca225ee069a 100644 --- a/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts +++ b/dev-packages/browser-integration-tests/suites/transport/offline/queued/test.ts @@ -8,13 +8,13 @@ function delay(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } -sentryTest('should queue and retry events when they fail to send', async ({ getLocalTestUrl, page }) => { +sentryTest('should queue and retry events when they fail to send', async ({ getLocalTestPath, page }) => { // makeBrowserOfflineTransport is not included in any CDN bundles if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle')) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); // This would be the obvious way to test offline support but it doesn't appear to work! // await context.setOffline(true); diff --git a/dev-packages/browser-integration-tests/suites/wasm/test.ts b/dev-packages/browser-integration-tests/suites/wasm/test.ts index 8b519a25fc4a..702b22a77a74 100644 --- a/dev-packages/browser-integration-tests/suites/wasm/test.ts +++ b/dev-packages/browser-integration-tests/suites/wasm/test.ts @@ -7,12 +7,12 @@ import { shouldSkipWASMTests } from '../../utils/wasmHelpers'; sentryTest( 'captured exception should include modified frames and debug_meta attribute', - async ({ getLocalTestUrl, page, browserName }) => { + async ({ getLocalTestPath, page, browserName }) => { if (shouldSkipWASMTests(browserName)) { sentryTest.skip(); } - const url = await getLocalTestUrl({ testDir: __dirname }); + const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/simple.wasm', route => { const wasmModule = fs.readFileSync(path.resolve(__dirname, 'simple.wasm')); diff --git a/dev-packages/browser-integration-tests/utils/fixtures.ts b/dev-packages/browser-integration-tests/utils/fixtures.ts index 0af573f517a0..9455e8c8626c 100644 --- a/dev-packages/browser-integration-tests/utils/fixtures.ts +++ b/dev-packages/browser-integration-tests/utils/fixtures.ts @@ -31,11 +31,11 @@ const getAsset = (assetDir: string, asset: string): string => { export type TestFixtures = { _autoSnapshotSuffix: void; testDir: string; + getLocalTestPath: (options: { testDir: string; skipDsnRouteHandler?: boolean }) => Promise; getLocalTestUrl: (options: { testDir: string; skipRouteHandler?: boolean; skipDsnRouteHandler?: boolean; - handleLazyLoadedFeedback?: boolean; }) => Promise; forceFlushReplay: () => Promise; enableConsole: () => void; @@ -59,59 +59,76 @@ const sentryTest = base.extend({ ], getLocalTestUrl: ({ page }, use) => { - return use( - async ({ testDir, skipRouteHandler = false, skipDsnRouteHandler = false, handleLazyLoadedFeedback = false }) => { - const pagePath = `${TEST_HOST}/index.html`; + return use(async ({ testDir, skipRouteHandler = false, skipDsnRouteHandler = false }) => { + const pagePath = `${TEST_HOST}/index.html`; - const tmpDir = path.join(testDir, 'dist', crypto.randomUUID()); + const tmpDir = path.join(testDir, 'dist', crypto.randomUUID()); - await build(testDir, tmpDir); + await build(testDir, tmpDir); - // If skipping route handlers we return the tmp dir instead of adding the handler - // This way, this can be handled by the caller manually - if (skipRouteHandler) { - return tmpDir; - } + // If skipping route handlers we return the tmp dir instead of adding the handler + // This way, this can be handled by the caller manually + if (skipRouteHandler) { + return tmpDir; + } - if (!skipDsnRouteHandler) { - await page.route('https://dsn.ingest.sentry.io/**/*', route => { - return route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ id: 'test-id' }), - }); + if (!skipDsnRouteHandler) { + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), }); + }); + } + + await page.route(`${TEST_HOST}/*.*`, route => { + const file = route.request().url().split('/').pop(); + const filePath = path.resolve(tmpDir, `./${file}`); + + return fs.existsSync(filePath) ? route.fulfill({ path: filePath }) : route.continue(); + }); + + // Ensure feedback can be lazy loaded + await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback-modal.min.js`, route => { + const filePath = path.resolve(tmpDir, './feedback-modal.bundle.js'); + if (!fs.existsSync(filePath)) { + throw new Error(`Feedback modal bundle (${filePath}) not found`); } + return route.fulfill({ path: filePath }); + }); - await page.route(`${TEST_HOST}/*.*`, route => { - const file = route.request().url().split('/').pop(); - const filePath = path.resolve(tmpDir, `./${file}`); + await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback-screenshot.min.js`, route => { + const filePath = path.resolve(tmpDir, './feedback-screenshot.bundle.js'); + if (!fs.existsSync(filePath)) { + throw new Error(`Feedback screenshot bundle (${filePath}) not found`); + } + return route.fulfill({ path: filePath }); + }); - return fs.existsSync(filePath) ? route.fulfill({ path: filePath }) : route.continue(); - }); + return pagePath; + }); + }, - if (handleLazyLoadedFeedback) { - // Ensure feedback can be lazy loaded - await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback-modal.min.js`, route => { - const filePath = path.resolve(tmpDir, './feedback-modal.bundle.js'); - if (!fs.existsSync(filePath)) { - throw new Error(`Feedback modal bundle (${filePath}) not found`); - } - return route.fulfill({ path: filePath }); - }); + getLocalTestPath: ({ page }, use) => { + return use(async ({ testDir, skipDsnRouteHandler }) => { + const tmpDir = path.join(testDir, 'dist', crypto.randomUUID()); + const pagePath = `file:///${path.resolve(tmpDir, './index.html')}`; + + await build(testDir, tmpDir); - await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback-screenshot.min.js`, route => { - const filePath = path.resolve(tmpDir, './feedback-screenshot.bundle.js'); - if (!fs.existsSync(filePath)) { - throw new Error(`Feedback screenshot bundle (${filePath}) not found`); - } - return route.fulfill({ path: filePath }); + if (!skipDsnRouteHandler) { + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), }); - } + }); + } - return pagePath; - }, - ); + return pagePath; + }); }, runInChromium: ({ runInSingleBrowser }, use) => { return use((fn, args) => runInSingleBrowser('chromium', fn, args)); diff --git a/dev-packages/browser-integration-tests/utils/helpers.ts b/dev-packages/browser-integration-tests/utils/helpers.ts index 01d92a07a8e5..4e836bc57528 100644 --- a/dev-packages/browser-integration-tests/utils/helpers.ts +++ b/dev-packages/browser-integration-tests/utils/helpers.ts @@ -1,5 +1,4 @@ import type { Page, Request } from '@playwright/test'; -import { parseEnvelope } from '@sentry/core'; import type { Envelope, EnvelopeItem, @@ -8,6 +7,7 @@ import type { EventEnvelope, EventEnvelopeHeaders, } from '@sentry/types'; +import { parseEnvelope } from '@sentry/utils'; export const envelopeUrlRegex = /\.sentry\.io\/api\/\d+\/envelope\//; diff --git a/dev-packages/e2e-tests/test-applications/angular-19/.editorconfig b/dev-packages/e2e-tests/test-applications/angular-19/.editorconfig deleted file mode 100644 index f166060da1cb..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -# Editor configuration, see https://editorconfig.org -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true - -[*.ts] -quote_type = single -ij_typescript_use_double_quotes = false - -[*.md] -max_line_length = off -trim_trailing_whitespace = false diff --git a/dev-packages/e2e-tests/test-applications/angular-19/.gitignore b/dev-packages/e2e-tests/test-applications/angular-19/.gitignore deleted file mode 100644 index 315c644a53e8..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/.gitignore +++ /dev/null @@ -1,44 +0,0 @@ -# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. - -# Compiled output -/dist -/tmp -/out-tsc -/bazel-out - -# Node -/node_modules -npm-debug.log -yarn-error.log - -# IDEs and editors -.idea/ -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# Visual Studio Code -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history/* - -# Miscellaneous -/.angular/cache -.sass-cache/ -/connect.lock -/coverage -/libpeerconnection.log -testem.log -/typings - -# System files -.DS_Store -Thumbs.db - -test-results diff --git a/dev-packages/e2e-tests/test-applications/angular-19/README.md b/dev-packages/e2e-tests/test-applications/angular-19/README.md deleted file mode 100644 index e971396e817c..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Angular 19 - -E2E test app for Angular 19 and `@sentry/angular`. diff --git a/dev-packages/e2e-tests/test-applications/angular-19/angular.json b/dev-packages/e2e-tests/test-applications/angular-19/angular.json deleted file mode 100644 index 446b28df1d25..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/angular.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "version": 1, - "newProjectRoot": "projects", - "projects": { - "angular-19": { - "projectType": "application", - "schematics": {}, - "root": "", - "sourceRoot": "src", - "prefix": "app", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:application", - "options": { - "outputPath": "dist/angular-19", - "index": "src/index.html", - "browser": "src/main.ts", - "polyfills": [ - "zone.js" - ], - "tsConfig": "tsconfig.app.json", - "assets": [ - { - "glob": "**/*", - "input": "public" - } - ], - "styles": [ - "src/styles.css" - ], - "scripts": [] - }, - "configurations": { - "production": { - "budgets": [ - { - "type": "initial", - "maximumWarning": "500kB", - "maximumError": "1MB" - }, - { - "type": "anyComponentStyle", - "maximumWarning": "4kB", - "maximumError": "8kB" - } - ], - "outputHashing": "all" - }, - "development": { - "optimization": false, - "extractLicenses": false, - "sourceMap": true - } - }, - "defaultConfiguration": "production" - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "configurations": { - "production": { - "buildTarget": "angular-19:build:production" - }, - "development": { - "buildTarget": "angular-19:build:development" - } - }, - "defaultConfiguration": "development" - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n" - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "polyfills": [ - "zone.js", - "zone.js/testing" - ], - "tsConfig": "tsconfig.spec.json", - "assets": [ - { - "glob": "**/*", - "input": "public" - } - ], - "styles": [ - "src/styles.css" - ], - "scripts": [] - } - } - } - } - } -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/package.json b/dev-packages/e2e-tests/test-applications/angular-19/package.json deleted file mode 100644 index 88b4334edbff..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "angular-19", - "version": "0.0.0", - "scripts": { - "ng": "ng", - "dev": "ng serve", - "proxy": "node start-event-proxy.mjs", - "preview": "http-server dist/angular-19/browser --port 8080", - "build": "ng build", - "watch": "ng build --watch --configuration development", - "test": "playwright test", - "test:build": "pnpm install && npx playwright install && pnpm build", - "test:assert": "playwright test", - "clean": "npx rimraf .angular node_modules pnpm-lock.yaml dist" - }, - "private": true, - "dependencies": { - "@angular/animations": "^19.0.0", - "@angular/common": "^19.0.0", - "@angular/compiler": "^19.0.0", - "@angular/core": "^19.0.0", - "@angular/forms": "^19.0.0", - "@angular/platform-browser": "^19.0.0", - "@angular/platform-browser-dynamic": "^19.0.0", - "@angular/router": "^19.0.0", - "@sentry/angular": "* || latest", - "rxjs": "~7.8.0", - "tslib": "^2.3.0", - "zone.js": "~0.15.0" - }, - "devDependencies": { - "@angular-devkit/build-angular": "^19.0.0", - "@angular/cli": "^19.0.0", - "@angular/compiler-cli": "^19.0.0", - "@playwright/test": "^1.44.1", - "@sentry-internal/test-utils": "link:../../../test-utils", - "@types/jasmine": "~5.1.0", - "http-server": "^14.1.1", - "jasmine-core": "~5.4.0", - "karma": "~6.4.0", - "karma-chrome-launcher": "~3.2.0", - "karma-coverage": "~2.2.0", - "karma-jasmine": "~5.1.0", - "karma-jasmine-html-reporter": "~2.1.0", - "typescript": "~5.6.2" - } -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/playwright.config.mjs b/dev-packages/e2e-tests/test-applications/angular-19/playwright.config.mjs deleted file mode 100644 index 0845325879c9..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/playwright.config.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import { getPlaywrightConfig } from '@sentry-internal/test-utils'; - -const config = getPlaywrightConfig({ - startCommand: `pnpm preview`, - port: 8080, -}); - -export default config; diff --git a/dev-packages/e2e-tests/test-applications/angular-19/public/favicon.ico b/dev-packages/e2e-tests/test-applications/angular-19/public/favicon.ico deleted file mode 100644 index 57614f9c9675..000000000000 Binary files a/dev-packages/e2e-tests/test-applications/angular-19/public/favicon.ico and /dev/null differ diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.component.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.component.ts deleted file mode 100644 index b79fcfcf453c..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Component } from '@angular/core'; -import { RouterOutlet } from '@angular/router'; - -@Component({ - selector: 'app-root', - standalone: true, - imports: [RouterOutlet], - template: ``, -}) -export class AppComponent { - title = 'angular-19'; -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.config.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.config.ts deleted file mode 100644 index f5cc30f3615b..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.config.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - ApplicationConfig, - ErrorHandler, - inject, - provideAppInitializer, - provideZoneChangeDetection, -} from '@angular/core'; -import { Router, provideRouter } from '@angular/router'; - -import { TraceService, createErrorHandler } from '@sentry/angular'; -import { routes } from './app.routes'; - -export const appConfig: ApplicationConfig = { - providers: [ - provideZoneChangeDetection({ eventCoalescing: true }), - provideRouter(routes), - { - provide: ErrorHandler, - useValue: createErrorHandler(), - }, - { - provide: TraceService, - deps: [Router], - }, - provideAppInitializer(() => { - inject(TraceService); - }), - ], -}; diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.routes.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.routes.ts deleted file mode 100644 index 24bf8b769051..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/app.routes.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Routes } from '@angular/router'; -import { cancelGuard } from './cancel-guard.guard'; -import { CancelComponent } from './cancel/cancel.components'; -import { ComponentTrackingComponent } from './component-tracking/component-tracking.components'; -import { HomeComponent } from './home/home.component'; -import { UserComponent } from './user/user.component'; - -export const routes: Routes = [ - { - path: 'users/:id', - component: UserComponent, - }, - { - path: 'home', - component: HomeComponent, - }, - { - path: 'cancel', - component: CancelComponent, - canActivate: [cancelGuard], - }, - { - path: 'component-tracking', - component: ComponentTrackingComponent, - }, - { - path: 'redirect1', - redirectTo: '/redirect2', - }, - { - path: 'redirect2', - redirectTo: '/redirect3', - }, - { - path: 'redirect3', - redirectTo: '/users/456', - }, - { - path: '**', - redirectTo: 'home', - }, -]; diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/cancel-guard.guard.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/cancel-guard.guard.ts deleted file mode 100644 index 16ec4a2ab164..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/cancel-guard.guard.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ActivatedRouteSnapshot, CanActivateFn, RouterStateSnapshot } from '@angular/router'; - -export const cancelGuard: CanActivateFn = (_next: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => { - return false; -}; diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/cancel/cancel.components.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/cancel/cancel.components.ts deleted file mode 100644 index b6ee1876e035..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/cancel/cancel.components.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-cancel', - standalone: true, - template: `
`, -}) -export class CancelComponent {} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/component-tracking/component-tracking.components.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/component-tracking/component-tracking.components.ts deleted file mode 100644 index d437a1d43fdd..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/component-tracking/component-tracking.components.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { AfterViewInit, Component, OnInit } from '@angular/core'; -import { TraceClass, TraceMethod, TraceModule } from '@sentry/angular'; -import { SampleComponent } from '../sample-component/sample-component.components'; - -@Component({ - selector: 'app-cancel', - standalone: true, - imports: [TraceModule, SampleComponent], - template: ``, -}) -@TraceClass({ name: 'ComponentTrackingComponent' }) -export class ComponentTrackingComponent implements OnInit, AfterViewInit { - @TraceMethod({ name: 'ngOnInit' }) - ngOnInit() {} - - @TraceMethod() - ngAfterViewInit() {} -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/home/home.component.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/home/home.component.ts deleted file mode 100644 index fe70dabd687a..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/home/home.component.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Component } from '@angular/core'; -import { RouterLink } from '@angular/router'; - -@Component({ - selector: 'app-home', - standalone: true, - imports: [RouterLink], - template: ` -
-

Welcome to Sentry's Angular 19 E2E test app

- - -
-`, -}) -export class HomeComponent { - throwError() { - throw new Error('Error thrown from Angular 18 E2E test app'); - } -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/sample-component/sample-component.components.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/sample-component/sample-component.components.ts deleted file mode 100644 index da09425c7565..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/sample-component/sample-component.components.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-sample-component', - standalone: true, - template: `
Component
`, -}) -export class SampleComponent implements OnInit { - ngOnInit() { - console.log('SampleComponent'); - } -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/app/user/user.component.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/app/user/user.component.ts deleted file mode 100644 index db02568d395f..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/app/user/user.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { AsyncPipe } from '@angular/common'; -import { Component } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { Observable, map } from 'rxjs'; - -@Component({ - selector: 'app-user', - standalone: true, - imports: [AsyncPipe], - template: ` -

Hello User {{ userId$ | async }}

- - `, -}) -export class UserComponent { - public userId$: Observable; - - constructor(private route: ActivatedRoute) { - this.userId$ = this.route.paramMap.pipe(map(params => params.get('id') || 'UNKNOWN USER')); - } - - throwError() { - throw new Error('Error thrown from user page'); - } -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/index.html b/dev-packages/e2e-tests/test-applications/angular-19/src/index.html deleted file mode 100644 index a0fab84284d8..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Angular19 - - - - - - - - diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/main.ts b/dev-packages/e2e-tests/test-applications/angular-19/src/main.ts deleted file mode 100644 index a0b841afc333..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/main.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { bootstrapApplication } from '@angular/platform-browser'; -import { AppComponent } from './app/app.component'; -import { appConfig } from './app/app.config'; - -import * as Sentry from '@sentry/angular'; - -Sentry.init({ - // Cannot use process.env here, so we hardcode the DSN - dsn: 'https://3b6c388182fb435097f41d181be2b2ba@o4504321058471936.ingest.sentry.io/4504321066008576', - tracesSampleRate: 1.0, - integrations: [Sentry.browserTracingIntegration({})], - tunnel: `http://localhost:3031/`, // proxy server -}); - -bootstrapApplication(AppComponent, appConfig).catch(err => console.error(err)); diff --git a/dev-packages/e2e-tests/test-applications/angular-19/src/styles.css b/dev-packages/e2e-tests/test-applications/angular-19/src/styles.css deleted file mode 100644 index 90d4ee0072ce..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/dev-packages/e2e-tests/test-applications/angular-19/start-event-proxy.mjs b/dev-packages/e2e-tests/test-applications/angular-19/start-event-proxy.mjs deleted file mode 100644 index b1b4620866bd..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/start-event-proxy.mjs +++ /dev/null @@ -1,6 +0,0 @@ -import { startEventProxyServer } from '@sentry-internal/test-utils'; - -startEventProxyServer({ - port: 3031, - proxyServerName: 'angular-18', -}); diff --git a/dev-packages/e2e-tests/test-applications/angular-19/tests/errors.test.ts b/dev-packages/e2e-tests/test-applications/angular-19/tests/errors.test.ts deleted file mode 100644 index 36d23bd077a5..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/tests/errors.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { expect, test } from '@playwright/test'; -import { waitForError, waitForTransaction } from '@sentry-internal/test-utils'; - -test('sends an error', async ({ page }) => { - const errorPromise = waitForError('angular-18', async errorEvent => { - return !errorEvent.type; - }); - - await page.goto(`/`); - - await page.locator('#errorBtn').click(); - - const error = await errorPromise; - - expect(error).toMatchObject({ - exception: { - values: [ - { - type: 'Error', - value: 'Error thrown from Angular 18 E2E test app', - mechanism: { - type: 'angular', - handled: false, - }, - }, - ], - }, - transaction: '/home/', - }); -}); - -test('assigns the correct transaction value after a navigation', async ({ page }) => { - const pageloadTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload'; - }); - - const errorPromise = waitForError('angular-18', async errorEvent => { - return !errorEvent.type; - }); - - await page.goto(`/`); - await pageloadTxnPromise; - - await page.waitForTimeout(5000); - - await page.locator('#navLink').click(); - - const [_, error] = await Promise.all([page.locator('#userErrorBtn').click(), errorPromise]); - - expect(error).toMatchObject({ - exception: { - values: [ - { - type: 'Error', - value: 'Error thrown from user page', - mechanism: { - type: 'angular', - handled: false, - }, - }, - ], - }, - transaction: '/users/:id/', - }); -}); diff --git a/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts b/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts deleted file mode 100644 index af85b8ffc405..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/tests/performance.test.ts +++ /dev/null @@ -1,313 +0,0 @@ -import { expect, test } from '@playwright/test'; -import { waitForTransaction } from '@sentry-internal/test-utils'; -import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; - -test('sends a pageload transaction with a parameterized URL', async ({ page }) => { - const transactionPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload'; - }); - - await page.goto(`/`); - - const rootSpan = await transactionPromise; - - expect(rootSpan).toMatchObject({ - contexts: { - trace: { - op: 'pageload', - origin: 'auto.pageload.angular', - }, - }, - transaction: '/home/', - transaction_info: { - source: 'route', - }, - }); -}); - -test('sends a navigation transaction with a parameterized URL', async ({ page }) => { - const pageloadTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload'; - }); - - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - await pageloadTxnPromise; - - await page.waitForTimeout(5000); - - const [_, navigationTxn] = await Promise.all([page.locator('#navLink').click(), navigationTxnPromise]); - - expect(navigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - }, - }, - transaction: '/users/:id/', - transaction_info: { - source: 'route', - }, - }); -}); - -test('sends a navigation transaction even if the pageload span is still active', async ({ page }) => { - const pageloadTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload'; - }); - - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, pageloadTxn, navigationTxn] = await Promise.all([ - page.locator('#navLink').click(), - pageloadTxnPromise, - navigationTxnPromise, - ]); - - expect(pageloadTxn).toMatchObject({ - contexts: { - trace: { - op: 'pageload', - origin: 'auto.pageload.angular', - }, - }, - transaction: '/home/', - transaction_info: { - source: 'route', - }, - }); - - expect(navigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.angular', - }, - }, - transaction: '/users/:id/', - transaction_info: { - source: 'route', - }, - }); -}); - -test('groups redirects within one navigation root span', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#redirectLink').click(), navigationTxnPromise]); - - expect(navigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.angular', - }, - }, - transaction: '/users/:id/', - transaction_info: { - source: 'route', - }, - }); - - const routingSpan = navigationTxn.spans?.find(span => span.op === 'ui.angular.routing'); - - expect(routingSpan).toBeDefined(); - expect(routingSpan?.description).toBe('/redirect1'); -}); - -test.describe('finish routing span', () => { - test('finishes routing span on navigation cancel', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#cancelLink').click(), navigationTxnPromise]); - - expect(navigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.angular', - }, - }, - transaction: '/cancel', - transaction_info: { - source: 'url', - }, - }); - - const routingSpan = navigationTxn.spans?.find(span => span.op === 'ui.angular.routing'); - - expect(routingSpan).toBeDefined(); - expect(routingSpan?.description).toBe('/cancel'); - }); - - test('finishes routing span on navigation error', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#nonExistentLink').click(), navigationTxnPromise]); - - const nonExistentRoute = '/non-existent'; - - expect(navigationTxn).toMatchObject({ - contexts: { - trace: { - op: 'navigation', - origin: 'auto.navigation.angular', - }, - }, - transaction: nonExistentRoute, - transaction_info: { - source: 'url', - }, - }); - - const routingSpan = navigationTxn.spans?.find(span => span.op === 'ui.angular.routing'); - - expect(routingSpan).toBeDefined(); - expect(routingSpan?.description).toBe(nonExistentRoute); - }); -}); - -test.describe('TraceDirective', () => { - test('creates a child tracingSpan with component name as span name on ngOnInit', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#componentTracking').click(), navigationTxnPromise]); - - const traceDirectiveSpan = navigationTxn.spans?.find( - span => span?.data && span?.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.ui.angular.trace_directive', - ); - - expect(traceDirectiveSpan).toBeDefined(); - expect(traceDirectiveSpan).toEqual( - expect.objectContaining({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive', - }, - description: '', - op: 'ui.angular.init', - origin: 'auto.ui.angular.trace_directive', - start_timestamp: expect.any(Number), - timestamp: expect.any(Number), - }), - ); - }); -}); - -test.describe('TraceClass Decorator', () => { - test('adds init span for decorated class', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#componentTracking').click(), navigationTxnPromise]); - - const classDecoratorSpan = navigationTxn.spans?.find( - span => span?.data && span?.data[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] === 'auto.ui.angular.trace_class_decorator', - ); - - expect(classDecoratorSpan).toBeDefined(); - expect(classDecoratorSpan).toEqual( - expect.objectContaining({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.init', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator', - }, - description: '', - op: 'ui.angular.init', - origin: 'auto.ui.angular.trace_class_decorator', - start_timestamp: expect.any(Number), - timestamp: expect.any(Number), - }), - ); - }); -}); - -test.describe('TraceMethod Decorator', () => { - test('adds name to span description of decorated method `ngOnInit`', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#componentTracking').click(), navigationTxnPromise]); - - const ngInitSpan = navigationTxn.spans?.find(span => span.op === 'ui.angular.ngOnInit'); - - expect(ngInitSpan).toBeDefined(); - expect(ngInitSpan).toEqual( - expect.objectContaining({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngOnInit', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', - }, - description: '', - op: 'ui.angular.ngOnInit', - origin: 'auto.ui.angular.trace_method_decorator', - start_timestamp: expect.any(Number), - timestamp: expect.any(Number), - }), - ); - }); - - test('adds fallback name to span description of decorated method `ngAfterViewInit`', async ({ page }) => { - const navigationTxnPromise = waitForTransaction('angular-18', async transactionEvent => { - return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation'; - }); - - await page.goto(`/`); - - // immediately navigate to a different route - const [_, navigationTxn] = await Promise.all([page.locator('#componentTracking').click(), navigationTxnPromise]); - - const ngAfterViewInitSpan = navigationTxn.spans?.find(span => span.op === 'ui.angular.ngAfterViewInit'); - - expect(ngAfterViewInitSpan).toBeDefined(); - expect(ngAfterViewInitSpan).toEqual( - expect.objectContaining({ - data: { - [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'ui.angular.ngAfterViewInit', - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator', - }, - description: '', - op: 'ui.angular.ngAfterViewInit', - origin: 'auto.ui.angular.trace_method_decorator', - start_timestamp: expect.any(Number), - timestamp: expect.any(Number), - }), - ); - }); -}); diff --git a/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.app.json b/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.app.json deleted file mode 100644 index 3775b37e3bbc..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.app.json +++ /dev/null @@ -1,15 +0,0 @@ -/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ -/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./out-tsc/app", - "types": [] - }, - "files": [ - "src/main.ts" - ], - "include": [ - "src/**/*.d.ts" - ] -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.json b/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.json deleted file mode 100644 index 5525117c6744..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ -/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ -{ - "compileOnSave": false, - "compilerOptions": { - "outDir": "./dist/out-tsc", - "strict": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "skipLibCheck": true, - "isolatedModules": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "moduleResolution": "bundler", - "importHelpers": true, - "target": "ES2022", - "module": "ES2022" - }, - "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, - "strictInjectionParameters": true, - "strictInputAccessModifiers": true, - "strictTemplates": true - } -} diff --git a/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.spec.json b/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.spec.json deleted file mode 100644 index 5fb748d9207a..000000000000 --- a/dev-packages/e2e-tests/test-applications/angular-19/tsconfig.spec.json +++ /dev/null @@ -1,15 +0,0 @@ -/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ -/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./out-tsc/spec", - "types": [ - "jasmine" - ] - }, - "include": [ - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] -} diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/package.json index 1b9747d95bdf..53ccbdff9e7f 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/package.json @@ -32,7 +32,7 @@ "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "^2.7.2", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@types/compression": "^1.7.2", "@types/express": "^4.17.17", "@types/morgan": "^1.9.4", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/tests/server-transactions.test.ts index 24b6024273d3..9dcf71e9af7f 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-legacy/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json index 534078696906..b7876bb08e44 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/package.json @@ -29,7 +29,7 @@ "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "^2.7.2", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@types/compression": "^1.7.5", "@types/express": "^4.17.20", "@types/morgan": "^1.9.9", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/server-transactions.test.ts index 2e91a73258f7..101900a8ac67 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json index 1b9747d95bdf..53ccbdff9e7f 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/package.json @@ -32,7 +32,7 @@ "@sentry-internal/test-utils": "link:../../../test-utils", "@remix-run/dev": "^2.7.2", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@types/compression": "^1.7.2", "@types/express": "^4.17.17", "@types/morgan": "^1.9.4", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts index 644760d220a6..b43d538ca683 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/package.json index 1bd69b66ff67..6b50ddc96b4a 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/package.json @@ -30,7 +30,7 @@ "@types/react": "^18.0.35", "@types/react-dom": "^18.0.11", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "eslint": "^8.38.0", "typescript": "^5.0.4" }, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/tests/server-transactions.test.ts index fd0bfc4aad20..ec9f2a1eefe9 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-legacy/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/package.json index 93938b75c6a1..a5f932f7cab4 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/package.json @@ -26,7 +26,7 @@ "@remix-run/dev": "2.7.2", "@remix-run/eslint-config": "2.7.2", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@types/react": "^18.0.35", "@types/react-dom": "^18.0.11", "eslint": "^8.38.0", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/tests/server-transactions.test.ts index e19a7056e158..d8926c5ff2d1 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2-legacy/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json index 17adb9ace8ae..a1fab6f6de9a 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/package.json @@ -26,7 +26,7 @@ "@remix-run/dev": "2.7.2", "@remix-run/eslint-config": "2.7.2", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@types/react": "^18.0.35", "@types/react-dom": "^18.0.11", "eslint": "^8.38.0", diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/server-transactions.test.ts index bb2664a0a447..e45492358c13 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/package.json b/dev-packages/e2e-tests/test-applications/create-remix-app/package.json index a3210d7c3187..4850fedf1e5d 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/package.json +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/package.json @@ -30,7 +30,7 @@ "@types/react": "^18.0.35", "@types/react-dom": "^18.0.11", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "eslint": "^8.38.0", "typescript": "^5.0.4" }, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/tests/server-transactions.test.ts b/dev-packages/e2e-tests/test-applications/create-remix-app/tests/server-transactions.test.ts index ac0534f4aaef..0a017b824ea5 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/tests/server-transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/tests/server-transactions.test.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import { waitForTransaction } from '@sentry-internal/test-utils'; diff --git a/dev-packages/e2e-tests/test-applications/generic-ts3.8/package.json b/dev-packages/e2e-tests/test-applications/generic-ts3.8/package.json index eda13af9e170..80875e5a2d0f 100644 --- a/dev-packages/e2e-tests/test-applications/generic-ts3.8/package.json +++ b/dev-packages/e2e-tests/test-applications/generic-ts3.8/package.json @@ -19,7 +19,7 @@ "@sentry/node": "latest || *", "@sentry-internal/replay": "latest || *", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sentry/wasm": "latest || *" } } diff --git a/dev-packages/e2e-tests/test-applications/nextjs-13/package.json b/dev-packages/e2e-tests/test-applications/nextjs-13/package.json index 51eaf9bf9fb4..c56d7c6ed204 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-13/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-13/package.json @@ -36,6 +36,7 @@ "@sentry/opentelemetry": "latest || *", "@sentry/react": "latest || *", "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", "@sentry/vercel-edge": "latest || *" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-14/package.json b/dev-packages/e2e-tests/test-applications/nextjs-14/package.json index f4569e1f6ceb..c8fcba03410d 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-14/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-14/package.json @@ -36,6 +36,7 @@ "@sentry/react": "latest || *", "@sentry-internal/replay": "latest || *", "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", "@sentry/vercel-edge": "latest || *" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-15/package.json b/dev-packages/e2e-tests/test-applications/nextjs-15/package.json index 6e9fb6af5b07..1c5754bd66da 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-15/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-15/package.json @@ -37,6 +37,7 @@ "@sentry/react": "latest || *", "@sentry-internal/replay": "latest || *", "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", "@sentry/vercel-edge": "latest || *" }, "volta": { diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json index 91791b89be75..b0bc898d9bd1 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json @@ -38,6 +38,7 @@ "@sentry/react": "latest || *", "@sentry-internal/replay": "latest || *", "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", "@sentry/vercel-edge": "latest || *", "ts-node": "10.9.1" }, diff --git a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts index ff61cb3bd682..75f30075a47f 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts +++ b/dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts @@ -33,12 +33,17 @@ test('Sends a transaction for a request to app router', async ({ page }) => { trace_id: expect.any(String), }); - expect(transactionEvent.request).toEqual({ - cookies: {}, - headers: expect.objectContaining({ - 'user-agent': expect.any(String), + expect(transactionEvent).toEqual( + expect.objectContaining({ + request: { + cookies: {}, + headers: expect.any(Object), + url: expect.any(String), + }, }), - }); + ); + + expect(Object.keys(transactionEvent.request?.headers!).length).toBeGreaterThan(0); // The transaction should not contain any spans with the same name as the transaction // e.g. "GET /server-component/parameter/[...parameters]" diff --git a/dev-packages/e2e-tests/test-applications/nextjs-turbo/package.json b/dev-packages/e2e-tests/test-applications/nextjs-turbo/package.json index 03d8a71dbcae..9cf05720fc28 100644 --- a/dev-packages/e2e-tests/test-applications/nextjs-turbo/package.json +++ b/dev-packages/e2e-tests/test-applications/nextjs-turbo/package.json @@ -36,6 +36,7 @@ "@sentry/react": "latest || *", "@sentry-internal/replay": "latest || *", "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", "@sentry/vercel-edge": "latest || *", "import-in-the-middle": "1.11.2" }, @@ -46,7 +47,6 @@ "extends": "../../package.json" }, "sentryTest": { - "optional": true, "optionalVariants": [ { "build-command": "test:build-canary", diff --git a/dev-packages/e2e-tests/test-applications/node-connect/package.json b/dev-packages/e2e-tests/test-applications/node-connect/package.json index bf2ec590b285..e13c082ef646 100644 --- a/dev-packages/e2e-tests/test-applications/node-connect/package.json +++ b/dev-packages/e2e-tests/test-applications/node-connect/package.json @@ -14,6 +14,7 @@ "@sentry/node": "latest || *", "@sentry/types": "latest || *", "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sentry/opentelemetry": "latest || *", "@types/node": "18.15.1", "connect": "3.7.0", diff --git a/dev-packages/e2e-tests/test-applications/node-fastify-5/package.json b/dev-packages/e2e-tests/test-applications/node-fastify-5/package.json index c60d9a3dae51..4d1385df12b8 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify-5/package.json +++ b/dev-packages/e2e-tests/test-applications/node-fastify-5/package.json @@ -14,6 +14,7 @@ "@sentry/node": "latest || *", "@sentry/types": "latest || *", "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sentry/opentelemetry": "latest || *", "@types/node": "22.7.5", "fastify": "5.0.0", diff --git a/dev-packages/e2e-tests/test-applications/node-fastify/package.json b/dev-packages/e2e-tests/test-applications/node-fastify/package.json index 0478786cd499..c862a9b7037b 100644 --- a/dev-packages/e2e-tests/test-applications/node-fastify/package.json +++ b/dev-packages/e2e-tests/test-applications/node-fastify/package.json @@ -14,6 +14,7 @@ "@sentry/node": "latest || *", "@sentry/types": "latest || *", "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sentry/opentelemetry": "latest || *", "@types/node": "18.15.1", "fastify": "4.23.2", diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts index 7fd15646dff2..cc5edc1fd878 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/tests/transactions.test.ts @@ -24,8 +24,6 @@ test('Captures a pageload transaction', async ({ page }) => { 'sentry.source': 'route', 'performance.timeOrigin': expect.any(Number), 'performance.activationStart': expect.any(Number), - 'lcp.renderTime': expect.any(Number), - 'lcp.loadTime': expect.any(Number), }, op: 'pageload', span_id: expect.any(String), diff --git a/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json b/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json index 55d4c5743e0a..bec942865d84 100644 --- a/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json +++ b/dev-packages/e2e-tests/test-applications/solid-solidrouter/package.json @@ -17,7 +17,7 @@ "@playwright/test": "^1.44.1", "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "autoprefixer": "^10.4.17", "postcss": "^8.4.33", "solid-devtools": "^0.29.2", diff --git a/dev-packages/e2e-tests/test-applications/solid/package.json b/dev-packages/e2e-tests/test-applications/solid/package.json index 51eccbae8a31..b4d896b081af 100644 --- a/dev-packages/e2e-tests/test-applications/solid/package.json +++ b/dev-packages/e2e-tests/test-applications/solid/package.json @@ -17,7 +17,7 @@ "@playwright/test": "^1.44.1", "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "autoprefixer": "^10.4.17", "postcss": "^8.4.33", "solid-devtools": "^0.29.2", diff --git a/dev-packages/e2e-tests/test-applications/svelte-5/package.json b/dev-packages/e2e-tests/test-applications/svelte-5/package.json index 0eb3d4154d40..9b6d6c5d0420 100644 --- a/dev-packages/e2e-tests/test-applications/svelte-5/package.json +++ b/dev-packages/e2e-tests/test-applications/svelte-5/package.json @@ -16,7 +16,7 @@ "@playwright/test": "^1.44.1", "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sveltejs/vite-plugin-svelte": "^3.0.2", "@tsconfig/svelte": "^5.0.2", "svelte": "^5.0.0-next.115", diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json index 192b56a98fe9..466e9feb5ffb 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-svelte-5/package.json @@ -1,36 +1,36 @@ { - "name": "sveltekit-2-svelte-5", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "proxy": "node start-event-proxy.mjs", - "clean": "npx rimraf node_modules pnpm-lock.yaml", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "test:prod": "TEST_ENV=production playwright test", - "test:build": "pnpm install && npx playwright install && pnpm build", - "test:assert": "pnpm test:prod" - }, - "dependencies": { - "@sentry/sveltekit": "latest || *", - "@spotlightjs/spotlight": "2.0.0-alpha.1" - }, - "devDependencies": { - "@playwright/test": "^1.44.1", - "@sentry-internal/test-utils": "link:../../../test-utils", - "@sentry/types": "latest || *", - "@sentry/core": "latest || *", - "@sveltejs/adapter-auto": "^3.0.0", - "@sveltejs/kit": "^2.0.0", - "@sveltejs/vite-plugin-svelte": "^3.0.0", - "svelte": "^5.0.0-next.115", - "svelte-check": "^3.6.0", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^5.4.10" - }, - "type": "module" + "name": "sveltekit-2-svelte-5", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "proxy": "node start-event-proxy.mjs", + "clean": "npx rimraf node_modules pnpm-lock.yaml", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "test:prod": "TEST_ENV=production playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:assert": "pnpm test:prod" + }, + "dependencies": { + "@sentry/sveltekit": "latest || *", + "@spotlightjs/spotlight": "2.0.0-alpha.1" + }, + "devDependencies": { + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", + "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "svelte": "^5.0.0-next.115", + "svelte-check": "^3.6.0", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^5.4.10" + }, + "type": "module" } diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2-twp/package.json b/dev-packages/e2e-tests/test-applications/sveltekit-2-twp/package.json index 56daf84e58b5..f03ee63f4fa0 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2-twp/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2-twp/package.json @@ -1,35 +1,35 @@ { - "name": "sveltekit-2-svelte-5", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "proxy": "node start-event-proxy.mjs", - "clean": "npx rimraf node_modules pnpm-lock.yaml", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "test:prod": "TEST_ENV=production playwright test", - "test:build": "pnpm install && npx playwright install && pnpm build", - "test:assert": "pnpm test:prod" - }, - "dependencies": { - "@sentry/sveltekit": "latest || *" - }, - "devDependencies": { - "@playwright/test": "^1.44.1", - "@sentry-internal/test-utils": "link:../../../test-utils", - "@sentry/types": "latest || *", - "@sentry/core": "latest || *", - "@sveltejs/adapter-auto": "^3.0.0", - "@sveltejs/kit": "^2.0.0", - "@sveltejs/vite-plugin-svelte": "^3.0.0", - "svelte": "^5.0.0-next.115", - "svelte-check": "^3.6.0", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^5.4.10" - }, - "type": "module" + "name": "sveltekit-2-svelte-5", + "version": "0.0.1", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "proxy": "node start-event-proxy.mjs", + "clean": "npx rimraf node_modules pnpm-lock.yaml", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "test:prod": "TEST_ENV=production playwright test", + "test:build": "pnpm install && npx playwright install && pnpm build", + "test:assert": "pnpm test:prod" + }, + "dependencies": { + "@sentry/sveltekit": "latest || *" + }, + "devDependencies": { + "@playwright/test": "^1.44.1", + "@sentry-internal/test-utils": "link:../../../test-utils", + "@sentry/types": "latest || *", + "@sentry/utils": "latest || *", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "svelte": "^5.0.0-next.115", + "svelte-check": "^3.6.0", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^5.4.10" + }, + "type": "module" } diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json b/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json index 080a23ebcfe8..d39fc123293a 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/package.json @@ -21,11 +21,11 @@ "@playwright/test": "^1.44.1", "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sveltejs/adapter-auto": "^3.0.0", "@sveltejs/adapter-node": "^2.0.0", "@sveltejs/kit": "^2.5.0", - "@sveltejs/vite-plugin-svelte": "^3.0.0", + "@sveltejs/vite-plugin-svelte": "^3.0.0", "svelte": "^4.2.8", "svelte-check": "^3.6.0", "typescript": "^5.0.0", diff --git a/dev-packages/e2e-tests/test-applications/sveltekit/package.json b/dev-packages/e2e-tests/test-applications/sveltekit/package.json index c7e9aa022d1e..563307252785 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit/package.json +++ b/dev-packages/e2e-tests/test-applications/sveltekit/package.json @@ -20,7 +20,7 @@ "@playwright/test": "^1.44.1", "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@sveltejs/adapter-auto": "^2.0.0", "@sveltejs/adapter-node": "^1.2.4", "@sveltejs/kit": "1.20.5", diff --git a/dev-packages/e2e-tests/test-applications/vue-3/package.json b/dev-packages/e2e-tests/test-applications/vue-3/package.json index 4f3125b81eb2..7c530c8acf06 100644 --- a/dev-packages/e2e-tests/test-applications/vue-3/package.json +++ b/dev-packages/e2e-tests/test-applications/vue-3/package.json @@ -24,7 +24,7 @@ "@playwright/test": "^1.44.1", "@sentry-internal/test-utils": "link:../../../test-utils", "@sentry/types": "latest || *", - "@sentry/core": "latest || *", + "@sentry/utils": "latest || *", "@tsconfig/node20": "^20.1.2", "@types/node": "^20.11.10", "@vitejs/plugin-vue": "^5.0.3", diff --git a/dev-packages/node-integration-tests/package.json b/dev-packages/node-integration-tests/package.json index 3d9b77b19ed8..581a6db3f977 100644 --- a/dev-packages/node-integration-tests/package.json +++ b/dev-packages/node-integration-tests/package.json @@ -34,7 +34,7 @@ "@sentry/aws-serverless": "8.39.0", "@sentry/node": "8.39.0", "@sentry/types": "8.39.0", - "@sentry/core": "8.39.0", + "@sentry/utils": "8.39.0", "@types/mongodb": "^3.6.20", "@types/mysql": "^2.15.21", "@types/pg": "^8.6.5", diff --git a/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-assign/test.ts b/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-assign/test.ts index 40bbb03f8d50..1ef9c11aff70 100644 --- a/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-assign/test.ts +++ b/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-assign/test.ts @@ -1,4 +1,4 @@ -import { TRACEPARENT_REGEXP } from '@sentry/core'; +import { TRACEPARENT_REGEXP } from '@sentry/utils'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; import type { TestAPIResponse } from '../server'; diff --git a/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-out/test.ts b/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-out/test.ts index db46bb491904..d9595bc6fc1a 100644 --- a/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-out/test.ts +++ b/dev-packages/node-integration-tests/suites/express/sentry-trace/trace-header-out/test.ts @@ -1,4 +1,4 @@ -import { TRACEPARENT_REGEXP } from '@sentry/core'; +import { TRACEPARENT_REGEXP } from '@sentry/utils'; import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; import type { TestAPIResponse } from '../server'; diff --git a/dev-packages/node-integration-tests/suites/tracing/nestjs-errors-no-express/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/nestjs-errors-no-express/scenario.ts index 3dcf30f97b20..e4f15f80fe70 100644 --- a/dev-packages/node-integration-tests/suites/tracing/nestjs-errors-no-express/scenario.ts +++ b/dev-packages/node-integration-tests/suites/tracing/nestjs-errors-no-express/scenario.ts @@ -48,7 +48,6 @@ class AppModule {} async function run(): Promise { const app = await NestFactory.create(AppModule); const { httpAdapter } = app.get(HttpAdapterHost); - // eslint-disable-next-line deprecation/deprecation Sentry.setupNestErrorHandler(app, new BaseExceptionFilter(httpAdapter)); await app.listen(port); sendPortToRunner(port); diff --git a/dev-packages/node-integration-tests/suites/tracing/nestjs-errors/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/nestjs-errors/scenario.ts index 6f4c9fa6955e..7cf65cbbbb1c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/nestjs-errors/scenario.ts +++ b/dev-packages/node-integration-tests/suites/tracing/nestjs-errors/scenario.ts @@ -46,7 +46,6 @@ class AppModule {} async function run(): Promise { const app = await NestFactory.create(AppModule); const { httpAdapter } = app.get(HttpAdapterHost); - // eslint-disable-next-line deprecation/deprecation Sentry.setupNestErrorHandler(app, new BaseExceptionFilter(httpAdapter)); await app.listen(port); sendPortToRunner(port); diff --git a/dev-packages/node-integration-tests/suites/tracing/nestjs-no-express/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/nestjs-no-express/scenario.ts index 62e042a4bf7a..e77888ded6a3 100644 --- a/dev-packages/node-integration-tests/suites/tracing/nestjs-no-express/scenario.ts +++ b/dev-packages/node-integration-tests/suites/tracing/nestjs-no-express/scenario.ts @@ -48,7 +48,6 @@ class AppModule {} async function run(): Promise { const app = await NestFactory.create(AppModule); const { httpAdapter } = app.get(HttpAdapterHost); - // eslint-disable-next-line deprecation/deprecation Sentry.setupNestErrorHandler(app, new BaseExceptionFilter(httpAdapter)); await app.listen(port); sendPortToRunner(port); diff --git a/dev-packages/node-integration-tests/suites/tracing/nestjs/scenario.ts b/dev-packages/node-integration-tests/suites/tracing/nestjs/scenario.ts index 449dc82fd070..2d4ac4e534cd 100644 --- a/dev-packages/node-integration-tests/suites/tracing/nestjs/scenario.ts +++ b/dev-packages/node-integration-tests/suites/tracing/nestjs/scenario.ts @@ -48,7 +48,6 @@ async function run(): Promise { await app.listen(port); const { httpAdapter } = app.get(HttpAdapterHost); - // eslint-disable-next-line deprecation/deprecation Sentry.setupNestErrorHandler(app, new BaseExceptionFilter(httpAdapter)); sendPortToRunner(port); } diff --git a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts index a0052511b380..a71bec82f893 100755 --- a/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts +++ b/dev-packages/node-integration-tests/suites/tracing/prisma-orm/setup.ts @@ -1,5 +1,5 @@ import { execSync } from 'child_process'; -import { parseSemver } from '@sentry/core'; +import { parseSemver } from '@sentry/utils'; const NODE_VERSION = parseSemver(process.versions.node); diff --git a/dev-packages/node-integration-tests/utils/assertions.ts b/dev-packages/node-integration-tests/utils/assertions.ts index 0f2713280282..68ce3941ff92 100644 --- a/dev-packages/node-integration-tests/utils/assertions.ts +++ b/dev-packages/node-integration-tests/utils/assertions.ts @@ -1,4 +1,3 @@ -import { SDK_VERSION } from '@sentry/core'; import type { ClientReport, Envelope, @@ -8,6 +7,7 @@ import type { SessionAggregates, TransactionEvent, } from '@sentry/types'; +import { SDK_VERSION } from '@sentry/utils'; /** * Asserts against a Sentry Event ignoring non-deterministic properties diff --git a/dev-packages/node-integration-tests/utils/index.ts b/dev-packages/node-integration-tests/utils/index.ts index 473a69c78cd8..0beedd250980 100644 --- a/dev-packages/node-integration-tests/utils/index.ts +++ b/dev-packages/node-integration-tests/utils/index.ts @@ -1,6 +1,6 @@ import type * as http from 'http'; -import { parseSemver } from '@sentry/core'; import type { EnvelopeItemType } from '@sentry/types'; +import { parseSemver } from '@sentry/utils'; const NODE_VERSION = parseSemver(process.versions.node).major; diff --git a/dev-packages/node-integration-tests/utils/runner.ts b/dev-packages/node-integration-tests/utils/runner.ts index 2b0a83f3c63e..1cbd9ade2e67 100644 --- a/dev-packages/node-integration-tests/utils/runner.ts +++ b/dev-packages/node-integration-tests/utils/runner.ts @@ -2,7 +2,6 @@ import { spawn, spawnSync } from 'child_process'; import { existsSync } from 'fs'; import { join } from 'path'; -import { normalize } from '@sentry/core'; import type { ClientReport, Envelope, @@ -14,6 +13,7 @@ import type { SessionAggregates, TransactionEvent, } from '@sentry/types'; +import { normalize } from '@sentry/utils'; import axios from 'axios'; import { assertEnvelopeHeader, diff --git a/dev-packages/node-integration-tests/utils/server.ts b/dev-packages/node-integration-tests/utils/server.ts index f46338d7de63..5f9afeeb556d 100644 --- a/dev-packages/node-integration-tests/utils/server.ts +++ b/dev-packages/node-integration-tests/utils/server.ts @@ -1,6 +1,6 @@ import type { AddressInfo } from 'net'; -import { parseEnvelope } from '@sentry/core'; import type { Envelope } from '@sentry/types'; +import { parseEnvelope } from '@sentry/utils'; import express from 'express'; /** diff --git a/dev-packages/rollup-utils/plugins/extractPolyfillsPlugin.mjs b/dev-packages/rollup-utils/plugins/extractPolyfillsPlugin.mjs index e0a21b400f35..e519f33b988f 100644 --- a/dev-packages/rollup-utils/plugins/extractPolyfillsPlugin.mjs +++ b/dev-packages/rollup-utils/plugins/extractPolyfillsPlugin.mjs @@ -40,10 +40,10 @@ export function makeExtractPolyfillsPlugin() { return null; } - // The index.js file of the core package will include identifiers named after polyfills so we would inject the + // The index.js file of the utils package will include identifiers named after polyfills so we would inject the // polyfills, however that would override the exports so we should just skip that file. - const isCorePackage = process.cwd().endsWith(`packages${path.sep}core`); - if (isCorePackage && sourceFile === 'index.js') { + const isUtilsPackage = process.cwd().endsWith(`packages${path.sep}utils`); + if (isUtilsPackage && sourceFile === 'index.js') { return null; } @@ -190,11 +190,13 @@ function createImportOrRequireNode(polyfillNodes, currentSourceFile, moduleForma variableDeclarator, } = recast.types.builders; - // Since our polyfills live in `@sentry/core`, if we're importing or requiring them there the path will have to be + // Since our polyfills live in `@sentry/utils`, if we're importing or requiring them there the path will have to be // relative - const isCorePackage = process.cwd().endsWith(path.join('packages', 'core')); + const isUtilsPackage = process.cwd().endsWith(path.join('packages', 'utils')); const importSource = literal( - isCorePackage ? `.${path.sep}${path.relative(path.dirname(currentSourceFile), 'buildPolyfills')}` : '@sentry/core', + isUtilsPackage + ? `.${path.sep}${path.relative(path.dirname(currentSourceFile), 'buildPolyfills')}` + : '@sentry/utils', ); // This is the `x, y, z` of inside of `import { x, y, z }` or `var { x, y, z }` diff --git a/dev-packages/test-utils/package.json b/dev-packages/test-utils/package.json index d386dee1df50..68795d7bbd08 100644 --- a/dev-packages/test-utils/package.json +++ b/dev-packages/test-utils/package.json @@ -46,7 +46,7 @@ "devDependencies": { "@playwright/test": "^1.44.1", "@sentry/types": "8.39.0", - "@sentry/core": "8.39.0" + "@sentry/utils": "8.39.0" }, "volta": { "extends": "../../package.json" diff --git a/dev-packages/test-utils/src/event-proxy-server.ts b/dev-packages/test-utils/src/event-proxy-server.ts index 73ced8df7053..6508dd9e5a0c 100644 --- a/dev-packages/test-utils/src/event-proxy-server.ts +++ b/dev-packages/test-utils/src/event-proxy-server.ts @@ -6,8 +6,8 @@ import * as os from 'os'; import * as path from 'path'; import * as util from 'util'; import * as zlib from 'zlib'; -import { parseEnvelope } from '@sentry/core'; import type { Envelope, EnvelopeItem, Event, SerializedSession } from '@sentry/types'; +import { parseEnvelope } from '@sentry/utils'; const readFile = util.promisify(fs.readFile); const writeFile = util.promisify(fs.writeFile); diff --git a/docs/migration/draft-v9-migration-guide.md b/docs/migration/draft-v9-migration-guide.md index d117d66ecae3..8b0cebd7e51d 100644 --- a/docs/migration/draft-v9-migration-guide.md +++ b/docs/migration/draft-v9-migration-guide.md @@ -11,24 +11,6 @@ ## `@sentry/core` - Deprecated `transactionNamingScheme` option in `requestDataIntegration`. -- Deprecated `debugIntegration`. To log outgoing events, use [Hook Options](https://docs.sentry.io/platforms/javascript/configuration/options/#hooks) (`beforeSend`, `beforeSendTransaction`, ...). -- Deprecated `sessionTimingIntegration`. To capture session durations alongside events, use [Context](https://docs.sentry.io/platforms/javascript/enriching-events/context/) (`Sentry.setContext()`). - -## `@sentry/nestjs` - -- Deprecated `@WithSentry`. Use `@SentryExceptionCaptured` instead. -- Deprecated `SentryTracingInterceptor`. - If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`. - If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards. -- Deprecated `SentryService`. - If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`. - If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService` afterwards. -- Deprecated `SentryGlobalGenericFilter`. - Use the `SentryGlobalFilter` instead. - The `SentryGlobalFilter` is a drop-in replacement. -- Deprecated `SentryGlobalGraphQLFilter`. - Use the `SentryGlobalFilter` instead. - The `SentryGlobalFilter` is a drop-in replacement. ## `@sentry/types` @@ -37,5 +19,3 @@ ## Server-side SDKs (`@sentry/node` and all dependents) - Deprecated `processThreadBreadcrumbIntegration` in favor of `childProcessIntegration`. Functionally they are the same. -- Deprecated `nestIntegration`. Use the NestJS SDK (`@sentry/nestjs`) instead. -- Deprecated `setupNestErrorHandler`. Use the NestJS SDK (`@sentry/nestjs`) instead. diff --git a/package.json b/package.json index 39139d5faba0..ce3f91932c64 100644 --- a/package.json +++ b/package.json @@ -152,13 +152,11 @@ "proseWrap": "always", "singleQuote": true, "trailingComma": "all", - "overrides": [ - { - "files": "*.md", - "options": { - "proseWrap": "preserve" - } + "overrides": [{ + "files": "CHANGELOG.md", + "options": { + "proseWrap": "preserve" } - ] + }] } } diff --git a/packages/angular/package.json b/packages/angular/package.json index af01c95686ed..a96812c53238 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -15,15 +15,16 @@ "access": "public" }, "peerDependencies": { - "@angular/common": ">= 14.x <= 19.x", - "@angular/core": ">= 14.x <= 19.x", - "@angular/router": ">= 14.x <= 19.x", + "@angular/common": ">= 14.x <= 18.x", + "@angular/core": ">= 14.x <= 18.x", + "@angular/router": ">= 14.x <= 18.x", "rxjs": "^6.5.5 || ^7.x" }, "dependencies": { "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "tslib": "^2.4.1" }, "devDependencies": { @@ -65,7 +66,10 @@ "nx": { "targets": { "build:transpile": { - "dependsOn": ["^build:transpile", "^build:types"], + "dependsOn": [ + "^build:transpile", + "^build:types" + ], "outputs": [ "{projectRoot}/build/esm2015", "{projectRoot}/build/fesm2015", diff --git a/packages/angular/src/errorhandler.ts b/packages/angular/src/errorhandler.ts index fdb765934ea1..f1771ba81b7e 100644 --- a/packages/angular/src/errorhandler.ts +++ b/packages/angular/src/errorhandler.ts @@ -3,8 +3,8 @@ import type { ErrorHandler as AngularErrorHandler, OnDestroy } from '@angular/co import { Inject, Injectable } from '@angular/core'; import * as Sentry from '@sentry/browser'; import type { ReportDialogOptions } from '@sentry/browser'; -import { consoleSandbox, isString } from '@sentry/core'; import type { Event } from '@sentry/types'; +import { consoleSandbox, isString } from '@sentry/utils'; import { runOutsideAngular } from './zone'; diff --git a/packages/angular/src/sdk.ts b/packages/angular/src/sdk.ts index d7cef5f55fdd..f8481a110887 100755 --- a/packages/angular/src/sdk.ts +++ b/packages/angular/src/sdk.ts @@ -13,8 +13,8 @@ import { functionToStringIntegration, inboundFiltersIntegration, } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { Client, Integration } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { IS_DEBUG_BUILD } from './flags'; diff --git a/packages/angular/src/tracing.ts b/packages/angular/src/tracing.ts index 0f5d3d49d211..7f97e7c32679 100644 --- a/packages/angular/src/tracing.ts +++ b/packages/angular/src/tracing.ts @@ -18,8 +18,8 @@ import { startBrowserTracingNavigationSpan, startInactiveSpan, } from '@sentry/browser'; -import { logger, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/core'; import type { Integration, Span } from '@sentry/types'; +import { logger, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/utils'; import type { Observable } from 'rxjs'; import { Subscription } from 'rxjs'; import { filter, tap } from 'rxjs/operators'; diff --git a/packages/astro/package.json b/packages/astro/package.json index b00c2b90f7e6..23843ca1dad0 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -60,6 +60,7 @@ "@sentry/core": "8.39.0", "@sentry/node": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@sentry/vite-plugin": "^2.22.6" }, "devDependencies": { diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 92e175b9205e..853623abbc8a 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -31,7 +31,6 @@ export { createTransport, cron, dataloaderIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, @@ -84,7 +83,6 @@ export { mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, NodeClient, nodeContextIntegration, @@ -105,7 +103,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, setContext, setCurrentClient, @@ -119,7 +116,6 @@ export { setupExpressErrorHandler, setupHapiErrorHandler, setupKoaErrorHandler, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, setUser, spanToBaggageHeader, diff --git a/packages/astro/src/integration/index.ts b/packages/astro/src/integration/index.ts index eb976e24213d..0a367a1bdf5d 100644 --- a/packages/astro/src/integration/index.ts +++ b/packages/astro/src/integration/index.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import { sentryVitePlugin } from '@sentry/vite-plugin'; import type { AstroConfig, AstroIntegration } from 'astro'; -import { dropUndefinedKeys } from '@sentry/core'; +import { dropUndefinedKeys } from '@sentry/utils'; import { buildClientSnippet, buildSdkInitFileImportSnippet, buildServerSnippet } from './snippets'; import type { SentryOptions } from './types'; diff --git a/packages/astro/src/server/middleware.ts b/packages/astro/src/server/middleware.ts index 781a5a75b7a9..50c8e973adfe 100644 --- a/packages/astro/src/server/middleware.ts +++ b/packages/astro/src/server/middleware.ts @@ -1,12 +1,3 @@ -import { - addNonEnumerableProperty, - extractQueryParamsFromUrl, - logger, - objectify, - stripUrlQueryAndFragment, - vercelWaitUntil, - winterCGRequestToRequestData, -} from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, @@ -21,7 +12,15 @@ import { startSpan, withIsolationScope, } from '@sentry/node'; -import type { RequestEventData, Scope, SpanAttributes } from '@sentry/types'; +import type { Scope, SpanAttributes } from '@sentry/types'; +import { + addNonEnumerableProperty, + logger, + objectify, + stripUrlQueryAndFragment, + vercelWaitUntil, + winterCGRequestToRequestData, +} from '@sentry/utils'; import type { APIContext, MiddlewareResponseHandler } from 'astro'; type MiddlewareOptions = { @@ -112,13 +111,7 @@ async function instrumentRequest( getCurrentScope().setSDKProcessingMetadata({ // We store the request on the current scope, not isolation scope, // because we may have multiple requests nested inside each other - normalizedRequest: (isDynamicPageRequest - ? winterCGRequestToRequestData(request) - : { - method, - url: request.url, - query_string: extractQueryParamsFromUrl(request.url), - }) satisfies RequestEventData, + request: isDynamicPageRequest ? winterCGRequestToRequestData(request) : { method, url: request.url }, }); if (options.trackClientIp && isDynamicPageRequest) { diff --git a/packages/astro/test/server/middleware.test.ts b/packages/astro/test/server/middleware.test.ts index 87fcb611eab2..093b2fad2d6b 100644 --- a/packages/astro/test/server/middleware.test.ts +++ b/packages/astro/test/server/middleware.test.ts @@ -221,7 +221,7 @@ describe('sentryMiddleware', () => { await middleware(ctx, next); expect(setSDKProcessingMetadataMock).toHaveBeenCalledWith({ - normalizedRequest: { + request: { method: 'GET', url: '/users', headers: { @@ -254,7 +254,7 @@ describe('sentryMiddleware', () => { await middleware(ctx, next); expect(setSDKProcessingMetadataMock).toHaveBeenCalledWith({ - normalizedRequest: { + request: { method: 'GET', url: '/users', }, diff --git a/packages/aws-serverless/package.json b/packages/aws-serverless/package.json index 897fdb25b0d2..662a65acfc2b 100644 --- a/packages/aws-serverless/package.json +++ b/packages/aws-serverless/package.json @@ -69,6 +69,7 @@ "@sentry/core": "8.39.0", "@sentry/node": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@types/aws-lambda": "^8.10.62" }, "devDependencies": { diff --git a/packages/aws-serverless/src/index.ts b/packages/aws-serverless/src/index.ts index e5e38100a257..8341b01719c1 100644 --- a/packages/aws-serverless/src/index.ts +++ b/packages/aws-serverless/src/index.ts @@ -101,9 +101,7 @@ export { mysql2Integration, redisIntegration, tediousIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, postgresIntegration, prismaIntegration, @@ -126,12 +124,10 @@ export { export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, } from '@sentry/core'; diff --git a/packages/aws-serverless/src/sdk.ts b/packages/aws-serverless/src/sdk.ts index 68522927b0a9..37df64d182dd 100644 --- a/packages/aws-serverless/src/sdk.ts +++ b/packages/aws-serverless/src/sdk.ts @@ -2,7 +2,6 @@ import { existsSync } from 'fs'; import { hostname } from 'os'; import { basename, resolve } from 'path'; import { types } from 'util'; -import { logger } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { SDK_VERSION, @@ -17,6 +16,7 @@ import { withScope, } from '@sentry/node'; import type { Integration, Options, Scope, SdkMetadata, Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import type { Context, Handler } from 'aws-lambda'; import { performance } from 'perf_hooks'; diff --git a/packages/aws-serverless/src/utils.ts b/packages/aws-serverless/src/utils.ts index b8a3e69dc0a9..f6461030c1a7 100644 --- a/packages/aws-serverless/src/utils.ts +++ b/packages/aws-serverless/src/utils.ts @@ -1,8 +1,8 @@ import type { TextMapGetter } from '@opentelemetry/api'; import type { Context as OtelContext } from '@opentelemetry/api'; import { context as otelContext, propagation } from '@opentelemetry/api'; -import { addExceptionMechanism, isString } from '@sentry/core'; import type { Scope } from '@sentry/types'; +import { addExceptionMechanism, isString } from '@sentry/utils'; import type { Handler } from 'aws-lambda'; import type { APIGatewayProxyEventHeaders } from 'aws-lambda'; diff --git a/packages/browser-utils/package.json b/packages/browser-utils/package.json index 0314056cc57c..bd2aed4a5d9b 100644 --- a/packages/browser-utils/package.json +++ b/packages/browser-utils/package.json @@ -40,7 +40,8 @@ }, "dependencies": { "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "scripts": { "build": "run-p build:transpile build:types", diff --git a/packages/browser-utils/src/getNativeImplementation.ts b/packages/browser-utils/src/getNativeImplementation.ts index 42d402eb1b94..6da58bfba623 100644 --- a/packages/browser-utils/src/getNativeImplementation.ts +++ b/packages/browser-utils/src/getNativeImplementation.ts @@ -1,4 +1,4 @@ -import { isNativeFunction, logger } from '@sentry/core'; +import { isNativeFunction, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import { WINDOW } from './types'; diff --git a/packages/browser-utils/src/instrument/dom.ts b/packages/browser-utils/src/instrument/dom.ts index 7ae8b0d04441..7172ca575225 100644 --- a/packages/browser-utils/src/instrument/dom.ts +++ b/packages/browser-utils/src/instrument/dom.ts @@ -1,6 +1,6 @@ import type { HandlerDataDom } from '@sentry/types'; -import { addHandler, addNonEnumerableProperty, fill, maybeInstrument, triggerHandlers, uuid4 } from '@sentry/core'; +import { addHandler, addNonEnumerableProperty, fill, maybeInstrument, triggerHandlers, uuid4 } from '@sentry/utils'; import { WINDOW } from '../types'; type SentryWrappedTarget = HTMLElement & { _sentryId?: string }; diff --git a/packages/browser-utils/src/instrument/history.ts b/packages/browser-utils/src/instrument/history.ts index be74cde68871..acb31dfc455d 100644 --- a/packages/browser-utils/src/instrument/history.ts +++ b/packages/browser-utils/src/instrument/history.ts @@ -1,5 +1,5 @@ -import { addHandler, fill, maybeInstrument, supportsHistory, triggerHandlers } from '@sentry/core'; import type { HandlerDataHistory } from '@sentry/types'; +import { addHandler, fill, maybeInstrument, supportsHistory, triggerHandlers } from '@sentry/utils'; import { WINDOW } from '../types'; let lastHref: string | undefined; diff --git a/packages/browser-utils/src/instrument/xhr.ts b/packages/browser-utils/src/instrument/xhr.ts index e97b7e54be60..c46662bf7c16 100644 --- a/packages/browser-utils/src/instrument/xhr.ts +++ b/packages/browser-utils/src/instrument/xhr.ts @@ -1,6 +1,6 @@ import type { HandlerDataXhr, SentryWrappedXMLHttpRequest } from '@sentry/types'; -import { addHandler, isString, maybeInstrument, timestampInSeconds, triggerHandlers } from '@sentry/core'; +import { addHandler, isString, maybeInstrument, timestampInSeconds, triggerHandlers } from '@sentry/utils'; import { WINDOW } from '../types'; export const SENTRY_XHR_DATA_KEY = '__sentry_xhr_v3__'; diff --git a/packages/browser-utils/src/metrics/browserMetrics.ts b/packages/browser-utils/src/metrics/browserMetrics.ts index d64bba34509a..09714e90c11f 100644 --- a/packages/browser-utils/src/metrics/browserMetrics.ts +++ b/packages/browser-utils/src/metrics/browserMetrics.ts @@ -1,8 +1,8 @@ /* eslint-disable max-lines */ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan } from '@sentry/core'; import { setMeasurement } from '@sentry/core'; -import { browserPerformanceTimeOrigin, getComponentName, htmlTreeAsString, logger, parseUrl } from '@sentry/core'; import type { Measurements, Span, SpanAttributes, StartSpanOptions } from '@sentry/types'; +import { browserPerformanceTimeOrigin, getComponentName, htmlTreeAsString, logger, parseUrl } from '@sentry/utils'; import { spanToJSON } from '@sentry/core'; import { DEBUG_BUILD } from '../debug-build'; @@ -635,18 +635,6 @@ function _setWebVitalAttributes(span: Span): void { span.setAttribute('lcp.url', _lcpEntry.url.trim().slice(0, 200)); } - if (_lcpEntry.loadTime != null) { - // loadTime is the time of LCP that's related to receiving the LCP element response.. - span.setAttribute('lcp.loadTime', _lcpEntry.loadTime); - } - - if (_lcpEntry.renderTime != null) { - // renderTime is loadTime + rendering time - // it's 0 if the LCP element is loaded from a 3rd party origin that doesn't send the - // `Timing-Allow-Origin` header. - span.setAttribute('lcp.renderTime', _lcpEntry.renderTime); - } - span.setAttribute('lcp.size', _lcpEntry.size); } diff --git a/packages/browser-utils/src/metrics/cls.ts b/packages/browser-utils/src/metrics/cls.ts index 1a7be525c3aa..e1d13286f5f9 100644 --- a/packages/browser-utils/src/metrics/cls.ts +++ b/packages/browser-utils/src/metrics/cls.ts @@ -10,8 +10,8 @@ import { getRootSpan, spanToJSON, } from '@sentry/core'; -import { browserPerformanceTimeOrigin, dropUndefinedKeys, htmlTreeAsString, logger } from '@sentry/core'; import type { SpanAttributes } from '@sentry/types'; +import { browserPerformanceTimeOrigin, dropUndefinedKeys, htmlTreeAsString, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { addClsInstrumentationHandler } from './instrument'; import { msToSec, startStandaloneWebVitalSpan } from './utils'; diff --git a/packages/browser-utils/src/metrics/inp.ts b/packages/browser-utils/src/metrics/inp.ts index c722e6425c3a..5814b139bd2d 100644 --- a/packages/browser-utils/src/metrics/inp.ts +++ b/packages/browser-utils/src/metrics/inp.ts @@ -9,8 +9,8 @@ import { getRootSpan, spanToJSON, } from '@sentry/core'; -import { browserPerformanceTimeOrigin, dropUndefinedKeys, htmlTreeAsString } from '@sentry/core'; import type { Span, SpanAttributes } from '@sentry/types'; +import { browserPerformanceTimeOrigin, dropUndefinedKeys, htmlTreeAsString } from '@sentry/utils'; import { addInpInstrumentationHandler, addPerformanceInstrumentationHandler, diff --git a/packages/browser-utils/src/metrics/instrument.ts b/packages/browser-utils/src/metrics/instrument.ts index 3f78c2e28605..39292fb19b83 100644 --- a/packages/browser-utils/src/metrics/instrument.ts +++ b/packages/browser-utils/src/metrics/instrument.ts @@ -1,4 +1,4 @@ -import { getFunctionName, logger } from '@sentry/core'; +import { getFunctionName, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { onCLS } from './web-vitals/getCLS'; diff --git a/packages/browser-utils/src/types.ts b/packages/browser-utils/src/types.ts index fd8f997907fc..c32d08c7f8e2 100644 --- a/packages/browser-utils/src/types.ts +++ b/packages/browser-utils/src/types.ts @@ -1,4 +1,4 @@ -import { GLOBAL_OBJ } from '@sentry/core'; +import { GLOBAL_OBJ } from '@sentry/utils'; export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & // document is not available in all browser environments (webworkers). We make it optional so you have to explicitly check for it diff --git a/packages/browser-utils/test/instrument/dom.test.ts b/packages/browser-utils/test/instrument/dom.test.ts index 102c6ba40829..ad1dc2fd82fa 100644 --- a/packages/browser-utils/test/instrument/dom.test.ts +++ b/packages/browser-utils/test/instrument/dom.test.ts @@ -1,11 +1,18 @@ import { instrumentDOM } from '../../src/instrument/dom'; -import { WINDOW } from '../../src/types'; -// @ts-expect-error - idk -WINDOW.XMLHttpRequest = undefined; +jest.mock('@sentry/utils', () => { + const original = jest.requireActual('@sentry/utils'); -describe('instrumentXHR', () => { - it('it does not throw if XMLHttpRequest is a key on window but not defined', () => { + return { + ...original, + GLOBAL_OBJ: { + document: undefined, + }, + }; +}); + +describe('instrumentDOM', () => { + it('it does not throw if document is a key on window but not defined', () => { expect(instrumentDOM).not.toThrow(); }); }); diff --git a/packages/browser-utils/test/instrument/xhr.test.ts b/packages/browser-utils/test/instrument/xhr.test.ts index e53999de628b..46fa1a477521 100644 --- a/packages/browser-utils/test/instrument/xhr.test.ts +++ b/packages/browser-utils/test/instrument/xhr.test.ts @@ -1,8 +1,14 @@ import { instrumentXHR } from '../../src/instrument/xhr'; -import { WINDOW } from '../../src/types'; -// @ts-expect-error - idk -WINDOW.XMLHttpRequest = undefined; +jest.mock('@sentry/utils', () => { + const original = jest.requireActual('@sentry/utils'); + return { + ...original, + GLOBAL_OBJ: { + XMLHttpRequest: undefined, + }, + }; +}); describe('instrumentXHR', () => { it('it does not throw if XMLHttpRequest is a key on window but not defined', () => { diff --git a/packages/browser-utils/test/utils/TestClient.ts b/packages/browser-utils/test/utils/TestClient.ts index 3bd5fff8cf76..da131aec8fd2 100644 --- a/packages/browser-utils/test/utils/TestClient.ts +++ b/packages/browser-utils/test/utils/TestClient.ts @@ -1,5 +1,4 @@ import { BaseClient, createTransport, initAndBind } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { BrowserClientReplayOptions, ClientOptions, @@ -7,6 +6,7 @@ import type { ParameterizedString, SeverityLevel, } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; export interface TestClientOptions extends ClientOptions, BrowserClientReplayOptions {} diff --git a/packages/browser/package.json b/packages/browser/package.json index 428ecbc6a992..061b7f356431 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -44,7 +44,8 @@ "@sentry-internal/replay": "8.39.0", "@sentry-internal/replay-canvas": "8.39.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "devDependencies": { "@sentry-internal/integration-shims": "8.39.0", diff --git a/packages/browser/src/client.ts b/packages/browser/src/client.ts index 8746fe6fda76..851f830d6955 100644 --- a/packages/browser/src/client.ts +++ b/packages/browser/src/client.ts @@ -1,7 +1,6 @@ import type { Scope } from '@sentry/core'; import { applySdkMetadata } from '@sentry/core'; import { BaseClient } from '@sentry/core'; -import { getSDKSource, logger } from '@sentry/core'; import type { BrowserClientProfilingOptions, BrowserClientReplayOptions, @@ -13,6 +12,7 @@ import type { SeverityLevel, UserFeedback, } from '@sentry/types'; +import { getSDKSource, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import { eventFromException, eventFromMessage } from './eventbuilder'; diff --git a/packages/browser/src/eventbuilder.ts b/packages/browser/src/eventbuilder.ts index b4ee8d581eb9..cff9f0fe4632 100644 --- a/packages/browser/src/eventbuilder.ts +++ b/packages/browser/src/eventbuilder.ts @@ -1,4 +1,13 @@ import { getClient } from '@sentry/core'; +import type { + Event, + EventHint, + Exception, + ParameterizedString, + SeverityLevel, + StackFrame, + StackParser, +} from '@sentry/types'; import { addExceptionMechanism, addExceptionTypeValue, @@ -12,16 +21,7 @@ import { isPlainObject, normalizeToSize, resolvedSyncPromise, -} from '@sentry/core'; -import type { - Event, - EventHint, - Exception, - ParameterizedString, - SeverityLevel, - StackFrame, - StackParser, -} from '@sentry/types'; +} from '@sentry/utils'; type Prototype = { constructor: (...args: unknown[]) => unknown }; diff --git a/packages/browser/src/helpers.ts b/packages/browser/src/helpers.ts index 8871b1ba2c68..702f44e36b7b 100644 --- a/packages/browser/src/helpers.ts +++ b/packages/browser/src/helpers.ts @@ -1,4 +1,5 @@ import { captureException, withScope } from '@sentry/core'; +import type { Mechanism, WrappedFunction } from '@sentry/types'; import { GLOBAL_OBJ, addExceptionMechanism, @@ -6,8 +7,7 @@ import { addNonEnumerableProperty, getOriginalFunction, markFunctionWrapped, -} from '@sentry/core'; -import type { Mechanism, WrappedFunction } from '@sentry/types'; +} from '@sentry/utils'; export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index bc720295b090..56724b926c5b 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -6,11 +6,9 @@ export { contextLinesIntegration } from './integrations/contextlines'; export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, captureFeedback, } from '@sentry/core'; diff --git a/packages/browser/src/integrations-bundle/index.debug.ts b/packages/browser/src/integrations-bundle/index.debug.ts index 7449888ce0ed..c6da394f3a13 100644 --- a/packages/browser/src/integrations-bundle/index.debug.ts +++ b/packages/browser/src/integrations-bundle/index.debug.ts @@ -1,3 +1,2 @@ -// eslint-disable-next-line deprecation/deprecation export { debugIntegration } from '@sentry/core'; export { spotlightBrowserIntegration } from '../integrations/spotlight'; diff --git a/packages/browser/src/integrations-bundle/index.sessiontiming.ts b/packages/browser/src/integrations-bundle/index.sessiontiming.ts index b601f2eb973b..ae495a70cc49 100644 --- a/packages/browser/src/integrations-bundle/index.sessiontiming.ts +++ b/packages/browser/src/integrations-bundle/index.sessiontiming.ts @@ -1,2 +1 @@ -// eslint-disable-next-line deprecation/deprecation export { sessionTimingIntegration } from '@sentry/core'; diff --git a/packages/browser/src/integrations/breadcrumbs.ts b/packages/browser/src/integrations/breadcrumbs.ts index 889e1a54c201..360668c4ba64 100644 --- a/packages/browser/src/integrations/breadcrumbs.ts +++ b/packages/browser/src/integrations/breadcrumbs.ts @@ -5,18 +5,6 @@ import { addXhrInstrumentationHandler, } from '@sentry-internal/browser-utils'; import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; -import { - addConsoleInstrumentationHandler, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - getComponentName, - getEventDescription, - htmlTreeAsString, - logger, - parseUrl, - safeJoin, - severityLevelFromString, -} from '@sentry/core'; import type { Breadcrumb, Client, @@ -32,6 +20,18 @@ import type { XhrBreadcrumbData, XhrBreadcrumbHint, } from '@sentry/types'; +import { + addConsoleInstrumentationHandler, + addFetchInstrumentationHandler, + getBreadcrumbLogLevelFromHttpStatusCode, + getComponentName, + getEventDescription, + htmlTreeAsString, + logger, + parseUrl, + safeJoin, + severityLevelFromString, +} from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/integrations/browserapierrors.ts b/packages/browser/src/integrations/browserapierrors.ts index 2290c1a45d66..8ede786f5c43 100644 --- a/packages/browser/src/integrations/browserapierrors.ts +++ b/packages/browser/src/integrations/browserapierrors.ts @@ -1,6 +1,6 @@ import { defineIntegration } from '@sentry/core'; -import { fill, getFunctionName, getOriginalFunction } from '@sentry/core'; import type { IntegrationFn, WrappedFunction } from '@sentry/types'; +import { fill, getFunctionName, getOriginalFunction } from '@sentry/utils'; import { WINDOW, wrap } from '../helpers'; diff --git a/packages/browser/src/integrations/contextlines.ts b/packages/browser/src/integrations/contextlines.ts index eb4dd7e7f748..8e77ea6f8a08 100644 --- a/packages/browser/src/integrations/contextlines.ts +++ b/packages/browser/src/integrations/contextlines.ts @@ -1,6 +1,6 @@ import { defineIntegration } from '@sentry/core'; -import { GLOBAL_OBJ, addContextToFrame, stripUrlQueryAndFragment } from '@sentry/core'; import type { Event, IntegrationFn, StackFrame } from '@sentry/types'; +import { GLOBAL_OBJ, addContextToFrame, stripUrlQueryAndFragment } from '@sentry/utils'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/integrations/globalhandlers.ts b/packages/browser/src/integrations/globalhandlers.ts index 2b9278adf767..b57fd8383155 100644 --- a/packages/browser/src/integrations/globalhandlers.ts +++ b/packages/browser/src/integrations/globalhandlers.ts @@ -1,4 +1,5 @@ import { captureEvent, defineIntegration, getClient } from '@sentry/core'; +import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/types'; import { UNKNOWN_FUNCTION, addGlobalErrorInstrumentationHandler, @@ -7,8 +8,7 @@ import { isPrimitive, isString, logger, -} from '@sentry/core'; -import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/types'; +} from '@sentry/utils'; import type { BrowserClient } from '../client'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/integrations/httpclient.ts b/packages/browser/src/integrations/httpclient.ts index 439941c97faf..af1c662007c3 100644 --- a/packages/browser/src/integrations/httpclient.ts +++ b/packages/browser/src/integrations/httpclient.ts @@ -1,13 +1,13 @@ import { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler } from '@sentry-internal/browser-utils'; import { captureEvent, defineIntegration, getClient, isSentryRequestUrl } from '@sentry/core'; +import type { Client, Event as SentryEvent, IntegrationFn, SentryWrappedXMLHttpRequest } from '@sentry/types'; import { GLOBAL_OBJ, addExceptionMechanism, addFetchInstrumentationHandler, logger, supportsNativeFetch, -} from '@sentry/core'; -import type { Client, Event as SentryEvent, IntegrationFn, SentryWrappedXMLHttpRequest } from '@sentry/types'; +} from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/integrations/linkederrors.ts b/packages/browser/src/integrations/linkederrors.ts index 41d15566f7a2..e107094950b1 100644 --- a/packages/browser/src/integrations/linkederrors.ts +++ b/packages/browser/src/integrations/linkederrors.ts @@ -1,6 +1,6 @@ import { defineIntegration } from '@sentry/core'; -import { applyAggregateErrorsToEvent } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; +import { applyAggregateErrorsToEvent } from '@sentry/utils'; import { exceptionFromError } from '../eventbuilder'; interface LinkedErrorsOptions { diff --git a/packages/browser/src/integrations/reportingobserver.ts b/packages/browser/src/integrations/reportingobserver.ts index 0e65216e3043..8212386493fb 100644 --- a/packages/browser/src/integrations/reportingobserver.ts +++ b/packages/browser/src/integrations/reportingobserver.ts @@ -1,6 +1,6 @@ import { captureMessage, defineIntegration, getClient, withScope } from '@sentry/core'; -import { GLOBAL_OBJ, supportsReportingObserver } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/types'; +import { GLOBAL_OBJ, supportsReportingObserver } from '@sentry/utils'; const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window; diff --git a/packages/browser/src/integrations/spotlight.ts b/packages/browser/src/integrations/spotlight.ts index 3c50939833d6..75ed18e7f34d 100644 --- a/packages/browser/src/integrations/spotlight.ts +++ b/packages/browser/src/integrations/spotlight.ts @@ -1,7 +1,7 @@ import { getNativeImplementation } from '@sentry-internal/browser-utils'; import { defineIntegration } from '@sentry/core'; -import { logger, serializeEnvelope } from '@sentry/core'; import type { Client, Envelope, Event, IntegrationFn } from '@sentry/types'; +import { logger, serializeEnvelope } from '@sentry/utils'; import type { WINDOW } from '../helpers'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/browser/src/profiling/integration.ts b/packages/browser/src/profiling/integration.ts index 1648fbf77a43..585ad28802b3 100644 --- a/packages/browser/src/profiling/integration.ts +++ b/packages/browser/src/profiling/integration.ts @@ -1,6 +1,6 @@ import { defineIntegration, getActiveSpan, getRootSpan } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { EventEnvelope, IntegrationFn, Profile, Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { startProfileForSpan } from './startProfileForSpan'; diff --git a/packages/browser/src/profiling/startProfileForSpan.ts b/packages/browser/src/profiling/startProfileForSpan.ts index fea01e6b64ae..8d7d91fdddc9 100644 --- a/packages/browser/src/profiling/startProfileForSpan.ts +++ b/packages/browser/src/profiling/startProfileForSpan.ts @@ -1,6 +1,6 @@ import { getCurrentScope, spanToJSON } from '@sentry/core'; -import { logger, timestampInSeconds, uuid4 } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { logger, timestampInSeconds, uuid4 } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/profiling/utils.ts b/packages/browser/src/profiling/utils.ts index 56ae15691aaf..926ea6bbb9f5 100644 --- a/packages/browser/src/profiling/utils.ts +++ b/packages/browser/src/profiling/utils.ts @@ -1,6 +1,7 @@ /* eslint-disable max-lines */ import { DEFAULT_ENVIRONMENT, getClient, spanToJSON } from '@sentry/core'; +import type { DebugImage, Envelope, Event, EventEnvelope, Profile, Span, ThreadCpuProfile } from '@sentry/types'; import { browserPerformanceTimeOrigin, forEachEnvelopeItem, @@ -8,8 +9,7 @@ import { logger, timestampInSeconds, uuid4, -} from '@sentry/core'; -import type { DebugImage, Envelope, Event, EventEnvelope, Profile, Span, ThreadCpuProfile } from '@sentry/types'; +} from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/sdk.ts b/packages/browser/src/sdk.ts index d758aae4b229..cd15af8fef1f 100644 --- a/packages/browser/src/sdk.ts +++ b/packages/browser/src/sdk.ts @@ -9,8 +9,8 @@ import { lastEventId, startSession, } from '@sentry/core'; -import { consoleSandbox, logger, stackParserFromStackParserOptions, supportsFetch } from '@sentry/core'; import type { Client, DsnLike, Integration, Options, UserFeedback } from '@sentry/types'; +import { consoleSandbox, logger, stackParserFromStackParserOptions, supportsFetch } from '@sentry/utils'; import { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils'; import { dedupeIntegration } from '@sentry/core'; diff --git a/packages/browser/src/stack-parsers.ts b/packages/browser/src/stack-parsers.ts index 1ac53e898349..2031c1861654 100644 --- a/packages/browser/src/stack-parsers.ts +++ b/packages/browser/src/stack-parsers.ts @@ -23,8 +23,8 @@ // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE // OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import { UNKNOWN_FUNCTION, createStackParser } from '@sentry/core'; import type { StackFrame, StackLineParser, StackLineParserFn } from '@sentry/types'; +import { UNKNOWN_FUNCTION, createStackParser } from '@sentry/utils'; const OPERA10_PRIORITY = 10; const OPERA11_PRIORITY = 20; diff --git a/packages/browser/src/tracing/backgroundtab.ts b/packages/browser/src/tracing/backgroundtab.ts index 178a95ccb5a2..307892862649 100644 --- a/packages/browser/src/tracing/backgroundtab.ts +++ b/packages/browser/src/tracing/backgroundtab.ts @@ -1,6 +1,6 @@ import { SPAN_STATUS_ERROR, getActiveSpan, getRootSpan } from '@sentry/core'; import { spanToJSON } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/tracing/browserTracingIntegration.ts b/packages/browser/src/tracing/browserTracingIntegration.ts index a59706edb8fb..b3f8d9abdba8 100644 --- a/packages/browser/src/tracing/browserTracingIntegration.ts +++ b/packages/browser/src/tracing/browserTracingIntegration.ts @@ -25,6 +25,8 @@ import { spanToJSON, startIdleSpan, } from '@sentry/core'; +import type { Client, IntegrationFn, StartSpanOptions, TransactionSource } from '@sentry/types'; +import type { Span } from '@sentry/types'; import { GLOBAL_OBJ, browserPerformanceTimeOrigin, @@ -32,9 +34,7 @@ import { getDomElement, logger, propagationContextFromHeaders, -} from '@sentry/core'; -import type { Client, IntegrationFn, StartSpanOptions, TransactionSource } from '@sentry/types'; -import type { Span } from '@sentry/types'; +} from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; diff --git a/packages/browser/src/tracing/request.ts b/packages/browser/src/tracing/request.ts index 79ed4d0f05b4..b41a0bf24cc6 100644 --- a/packages/browser/src/tracing/request.ts +++ b/packages/browser/src/tracing/request.ts @@ -21,6 +21,7 @@ import { spanToTraceHeader, startInactiveSpan, } from '@sentry/core'; +import type { Client, HandlerDataXhr, SentryWrappedXMLHttpRequest, Span } from '@sentry/types'; import { BAGGAGE_HEADER_NAME, addFetchEndInstrumentationHandler, @@ -30,8 +31,7 @@ import { generateSentryTraceHeader, parseUrl, stringMatchesSomePattern, -} from '@sentry/core'; -import type { Client, HandlerDataXhr, SentryWrappedXMLHttpRequest, Span } from '@sentry/types'; +} from '@sentry/utils'; import { WINDOW } from '../helpers'; /** Options for Request Instrumentation */ diff --git a/packages/browser/src/transports/fetch.ts b/packages/browser/src/transports/fetch.ts index efbe132afe1f..d1ded0f7da84 100644 --- a/packages/browser/src/transports/fetch.ts +++ b/packages/browser/src/transports/fetch.ts @@ -1,7 +1,7 @@ import { clearCachedImplementation, getNativeImplementation } from '@sentry-internal/browser-utils'; import { createTransport } from '@sentry/core'; -import { rejectedSyncPromise } from '@sentry/core'; import type { Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types'; +import { rejectedSyncPromise } from '@sentry/utils'; import type { WINDOW } from '../helpers'; import type { BrowserTransportOptions } from './types'; diff --git a/packages/browser/src/transports/offline.ts b/packages/browser/src/transports/offline.ts index 152539ce85f9..7f5d22e466a9 100644 --- a/packages/browser/src/transports/offline.ts +++ b/packages/browser/src/transports/offline.ts @@ -1,7 +1,7 @@ import type { OfflineStore, OfflineTransportOptions } from '@sentry/core'; import { makeOfflineTransport } from '@sentry/core'; -import { parseEnvelope, serializeEnvelope } from '@sentry/core'; import type { BaseTransportOptions, Envelope, Transport } from '@sentry/types'; +import { parseEnvelope, serializeEnvelope } from '@sentry/utils'; import { makeFetchTransport } from './fetch'; // 'Store', 'promisifyRequest' and 'createStore' were originally copied from the 'idb-keyval' package before being diff --git a/packages/browser/src/userfeedback.ts b/packages/browser/src/userfeedback.ts index a406e31d2e25..c2c8b0a116fc 100644 --- a/packages/browser/src/userfeedback.ts +++ b/packages/browser/src/userfeedback.ts @@ -1,5 +1,5 @@ -import { createEnvelope, dsnToString } from '@sentry/core'; import type { DsnComponents, EventEnvelope, SdkMetadata, UserFeedback, UserFeedbackItem } from '@sentry/types'; +import { createEnvelope, dsnToString } from '@sentry/utils'; /** * Creates an envelope from a user feedback. diff --git a/packages/browser/test/helper/browser-client-options.ts b/packages/browser/test/helper/browser-client-options.ts index 661e0a9d1c72..619baab13bad 100644 --- a/packages/browser/test/helper/browser-client-options.ts +++ b/packages/browser/test/helper/browser-client-options.ts @@ -1,5 +1,5 @@ import { createTransport } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; +import { resolvedSyncPromise } from '@sentry/utils'; import type { BrowserClientOptions } from '../../src/client'; diff --git a/packages/browser/test/index.test.ts b/packages/browser/test/index.test.ts index 42492cd36747..eb2fb6104b11 100644 --- a/packages/browser/test/index.test.ts +++ b/packages/browser/test/index.test.ts @@ -13,7 +13,7 @@ import { inboundFiltersIntegration, lastEventId, } from '@sentry/core'; -import * as utils from '@sentry/core'; +import * as utils from '@sentry/utils'; import { setCurrentClient } from '../src'; import { diff --git a/packages/browser/test/mocks/simpletransport.ts b/packages/browser/test/mocks/simpletransport.ts index 1193e217cb38..cbad94fb310d 100644 --- a/packages/browser/test/mocks/simpletransport.ts +++ b/packages/browser/test/mocks/simpletransport.ts @@ -1,5 +1,5 @@ import { createTransport } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; +import { resolvedSyncPromise } from '@sentry/utils'; export function makeSimpleTransport() { return createTransport({ recordDroppedEvent: () => undefined }, () => resolvedSyncPromise({})); diff --git a/packages/browser/test/sdk.test.ts b/packages/browser/test/sdk.test.ts index 4929ee0f83d2..d638862aba9d 100644 --- a/packages/browser/test/sdk.test.ts +++ b/packages/browser/test/sdk.test.ts @@ -8,8 +8,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import * as SentryCore from '@sentry/core'; import { Scope, createTransport } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { Client, Integration } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; import type { BrowserOptions } from '../src'; import { WINDOW } from '../src'; diff --git a/packages/browser/test/tracekit/ie.test.ts b/packages/browser/test/tracekit/ie.test.ts index 97659959252f..95d88a6bef34 100644 --- a/packages/browser/test/tracekit/ie.test.ts +++ b/packages/browser/test/tracekit/ie.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { createStackParser } from '@sentry/core'; +import { createStackParser } from '@sentry/utils'; import { exceptionFromError } from '../../src/eventbuilder'; import { chromeStackLineParser, geckoStackLineParser, winjsStackLineParser } from '../../src/stack-parsers'; diff --git a/packages/browser/test/tracekit/opera.test.ts b/packages/browser/test/tracekit/opera.test.ts index 8de84f0dcb01..352737fba5d0 100644 --- a/packages/browser/test/tracekit/opera.test.ts +++ b/packages/browser/test/tracekit/opera.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { createStackParser } from '@sentry/core'; +import { createStackParser } from '@sentry/utils'; import { exceptionFromError } from '../../src/eventbuilder'; import { defaultStackParser, opera10StackLineParser, opera11StackLineParser } from '../../src/stack-parsers'; diff --git a/packages/browser/test/tracing/request.test.ts b/packages/browser/test/tracing/request.test.ts index cf11e59a013c..4f1c0bfdaf0a 100644 --- a/packages/browser/test/tracing/request.test.ts +++ b/packages/browser/test/tracing/request.test.ts @@ -1,8 +1,8 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import * as browserUtils from '@sentry-internal/browser-utils'; -import * as utils from '@sentry/core'; import type { Client } from '@sentry/types'; +import * as utils from '@sentry/utils'; import { WINDOW } from '../../src/helpers'; import { extractNetworkProtocol, instrumentOutgoingRequests, shouldAttachHeaders } from '../../src/tracing/request'; diff --git a/packages/browser/test/transports/fetch.test.ts b/packages/browser/test/transports/fetch.test.ts index 1b88e6263820..ccba3282251c 100644 --- a/packages/browser/test/transports/fetch.test.ts +++ b/packages/browser/test/transports/fetch.test.ts @@ -1,8 +1,8 @@ import type { Mock } from 'vitest'; import { describe, expect, it, vi } from 'vitest'; -import { createEnvelope, serializeEnvelope } from '@sentry/core'; import type { EventEnvelope, EventItem } from '@sentry/types'; +import { createEnvelope, serializeEnvelope } from '@sentry/utils'; import { makeFetchTransport } from '../../src/transports/fetch'; import type { BrowserTransportOptions } from '../../src/transports/types'; diff --git a/packages/browser/test/transports/offline.test.ts b/packages/browser/test/transports/offline.test.ts index 9f0e5ae5cdba..a8352cb4102d 100644 --- a/packages/browser/test/transports/offline.test.ts +++ b/packages/browser/test/transports/offline.test.ts @@ -4,13 +4,13 @@ import 'fake-indexeddb/auto'; import { TextDecoder, TextEncoder } from 'util'; import { createTransport } from '@sentry/core'; -import { createEnvelope } from '@sentry/core'; import type { EventEnvelope, EventItem, InternalBaseTransportOptions, TransportMakeRequestResponse, } from '@sentry/types'; +import { createEnvelope } from '@sentry/utils'; import { createStore, makeBrowserOfflineTransport, push, shift, unshift } from '../../src/transports/offline'; diff --git a/packages/bun/package.json b/packages/bun/package.json index ffd16b27a4f3..09fc9fb933ed 100644 --- a/packages/bun/package.json +++ b/packages/bun/package.json @@ -42,7 +42,8 @@ "@sentry/core": "8.39.0", "@sentry/node": "8.39.0", "@sentry/opentelemetry": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "devDependencies": { "bun-types": "latest" diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index 29776ef4ab1d..d8c97d6e8246 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -18,7 +18,7 @@ export type { Thread, User, } from '@sentry/types'; -export type { AddRequestDataToEventOptions } from '@sentry/core'; +export type { AddRequestDataToEventOptions } from '@sentry/utils'; export { addEventProcessor, @@ -124,9 +124,7 @@ export { mysql2Integration, redisIntegration, tediousIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, postgresIntegration, prismaIntegration, @@ -146,12 +144,10 @@ export { export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, } from '@sentry/core'; diff --git a/packages/bun/src/integrations/bunserver.ts b/packages/bun/src/integrations/bunserver.ts index f2811a026919..193ae6f286ca 100644 --- a/packages/bun/src/integrations/bunserver.ts +++ b/packages/bun/src/integrations/bunserver.ts @@ -9,8 +9,8 @@ import { startSpan, withIsolationScope, } from '@sentry/core'; -import { extractQueryParamsFromUrl, getSanitizedUrlString, parseUrl } from '@sentry/core'; -import type { IntegrationFn, RequestEventData, SpanAttributes } from '@sentry/types'; +import type { IntegrationFn, SpanAttributes } from '@sentry/types'; +import { getSanitizedUrlString, parseUrl } from '@sentry/utils'; const INTEGRATION_NAME = 'BunServer'; @@ -76,12 +76,11 @@ function instrumentBunServeOptions(serveOptions: Parameters[0] const url = getSanitizedUrlString(parsedUrl); isolationScope.setSDKProcessingMetadata({ - normalizedRequest: { + request: { url, method: request.method, headers: request.headers.toJSON(), - query_string: extractQueryParamsFromUrl(url), - } satisfies RequestEventData, + }, }); return continueTrace( diff --git a/packages/bun/src/transports/index.ts b/packages/bun/src/transports/index.ts index 0dd3da97638b..b4968f2001c0 100644 --- a/packages/bun/src/transports/index.ts +++ b/packages/bun/src/transports/index.ts @@ -1,6 +1,6 @@ import { createTransport, suppressTracing } from '@sentry/core'; -import { rejectedSyncPromise } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types'; +import { rejectedSyncPromise } from '@sentry/utils'; export interface BunTransportOptions extends BaseTransportOptions { /** Custom headers for the transport. Used by the XHRTransport and FetchTransport */ diff --git a/packages/bun/test/helpers.ts b/packages/bun/test/helpers.ts index a8286378761f..61b4de5e65f1 100644 --- a/packages/bun/test/helpers.ts +++ b/packages/bun/test/helpers.ts @@ -1,5 +1,5 @@ import { createTransport } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; +import { resolvedSyncPromise } from '@sentry/utils'; import type { BunClientOptions } from '../src/types'; diff --git a/packages/cloudflare/package.json b/packages/cloudflare/package.json index fbffab088235..edffa857c0c4 100644 --- a/packages/cloudflare/package.json +++ b/packages/cloudflare/package.json @@ -40,7 +40,8 @@ }, "dependencies": { "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "optionalDependencies": { "@cloudflare/workers-types": "^4.x" diff --git a/packages/cloudflare/src/index.ts b/packages/cloudflare/src/index.ts index 106cf4ab22fb..4115874aa5e5 100644 --- a/packages/cloudflare/src/index.ts +++ b/packages/cloudflare/src/index.ts @@ -18,7 +18,7 @@ export type { Thread, User, } from '@sentry/types'; -export type { AddRequestDataToEventOptions } from '@sentry/core'; +export type { AddRequestDataToEventOptions } from '@sentry/utils'; export type { CloudflareOptions } from './client'; @@ -74,7 +74,6 @@ export { linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, rewriteFramesIntegration, diff --git a/packages/cloudflare/src/integrations/fetch.ts b/packages/cloudflare/src/integrations/fetch.ts index 2fbb93315795..4bada212e7d5 100644 --- a/packages/cloudflare/src/integrations/fetch.ts +++ b/packages/cloudflare/src/integrations/fetch.ts @@ -1,10 +1,4 @@ import { addBreadcrumb, defineIntegration, getClient, instrumentFetchRequest, isSentryRequestUrl } from '@sentry/core'; -import { - LRUMap, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - stringMatchesSomePattern, -} from '@sentry/core'; import type { Client, FetchBreadcrumbData, @@ -13,6 +7,12 @@ import type { IntegrationFn, Span, } from '@sentry/types'; +import { + LRUMap, + addFetchInstrumentationHandler, + getBreadcrumbLogLevelFromHttpStatusCode, + stringMatchesSomePattern, +} from '@sentry/utils'; const INTEGRATION_NAME = 'Fetch'; diff --git a/packages/cloudflare/src/request.ts b/packages/cloudflare/src/request.ts index cda67bfb7314..1c51a08c194c 100644 --- a/packages/cloudflare/src/request.ts +++ b/packages/cloudflare/src/request.ts @@ -13,8 +13,8 @@ import { startSpan, withIsolationScope, } from '@sentry/core'; -import { stripUrlQueryAndFragment } from '@sentry/core'; import type { SpanAttributes } from '@sentry/types'; +import { stripUrlQueryAndFragment } from '@sentry/utils'; import type { CloudflareOptions } from './client'; import { addCloudResourceContext, addCultureContext, addRequest } from './scope-utils'; import { init } from './sdk'; diff --git a/packages/cloudflare/src/scope-utils.ts b/packages/cloudflare/src/scope-utils.ts index afa155907766..1f5bbce8f0fc 100644 --- a/packages/cloudflare/src/scope-utils.ts +++ b/packages/cloudflare/src/scope-utils.ts @@ -1,7 +1,7 @@ import type { IncomingRequestCfProperties } from '@cloudflare/workers-types'; -import { winterCGRequestToRequestData } from '@sentry/core'; import type { Scope } from '@sentry/types'; +import { winterCGRequestToRequestData } from '@sentry/utils'; /** * Set cloud resource context on scope. @@ -25,5 +25,5 @@ export function addCultureContext(scope: Scope, cf: IncomingRequestCfProperties) * Set request data on scope */ export function addRequest(scope: Scope, request: Request): void { - scope.setSDKProcessingMetadata({ normalizedRequest: winterCGRequestToRequestData(request) }); + scope.setSDKProcessingMetadata({ request: winterCGRequestToRequestData(request) }); } diff --git a/packages/cloudflare/src/sdk.ts b/packages/cloudflare/src/sdk.ts index 0c8a50c4e44d..a16a9e578a06 100644 --- a/packages/cloudflare/src/sdk.ts +++ b/packages/cloudflare/src/sdk.ts @@ -7,8 +7,8 @@ import { linkedErrorsIntegration, requestDataIntegration, } from '@sentry/core'; -import { stackParserFromStackParserOptions } from '@sentry/core'; import type { Integration } from '@sentry/types'; +import { stackParserFromStackParserOptions } from '@sentry/utils'; import type { CloudflareClientOptions, CloudflareOptions } from './client'; import { CloudflareClient } from './client'; diff --git a/packages/cloudflare/src/transport.ts b/packages/cloudflare/src/transport.ts index 9854a9050b51..4f1314d693a7 100644 --- a/packages/cloudflare/src/transport.ts +++ b/packages/cloudflare/src/transport.ts @@ -1,6 +1,6 @@ import { createTransport, suppressTracing } from '@sentry/core'; -import { SentryError } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types'; +import { SentryError } from '@sentry/utils'; export interface CloudflareTransportOptions extends BaseTransportOptions { /** Fetch API init parameters. */ diff --git a/packages/cloudflare/src/vendor/stacktrace.ts b/packages/cloudflare/src/vendor/stacktrace.ts index 303600d495df..1a91abe26d24 100644 --- a/packages/cloudflare/src/vendor/stacktrace.ts +++ b/packages/cloudflare/src/vendor/stacktrace.ts @@ -21,8 +21,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -import { basename, createStackParser, nodeStackLineParser } from '@sentry/core'; import type { StackLineParser, StackLineParserFn, StackParser } from '@sentry/types'; +import { basename, createStackParser, nodeStackLineParser } from '@sentry/utils'; type GetModuleFn = (filename: string | undefined) => string | undefined; diff --git a/packages/cloudflare/test/async.test.ts b/packages/cloudflare/test/async.test.ts index 23ae7637dd19..a4423e0ca434 100644 --- a/packages/cloudflare/test/async.test.ts +++ b/packages/cloudflare/test/async.test.ts @@ -1,5 +1,5 @@ import { Scope, getCurrentScope, getGlobalScope, getIsolationScope, withIsolationScope, withScope } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; +import { GLOBAL_OBJ } from '@sentry/utils'; import { AsyncLocalStorage } from 'async_hooks'; import { beforeEach, describe, expect, it } from 'vitest'; import { setAsyncLocalStorageAsyncContextStrategy } from '../src/async'; diff --git a/packages/cloudflare/test/integrations/fetch.test.ts b/packages/cloudflare/test/integrations/fetch.test.ts index 86bb092facc8..3825a27b985b 100644 --- a/packages/cloudflare/test/integrations/fetch.test.ts +++ b/packages/cloudflare/test/integrations/fetch.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import * as sentryCore from '@sentry/core'; -import * as sentryUtils from '@sentry/core'; -import { createStackParser } from '@sentry/core'; import type { HandlerDataFetch, Integration } from '@sentry/types'; +import * as sentryUtils from '@sentry/utils'; +import { createStackParser } from '@sentry/utils'; import { CloudflareClient } from '../../src/client'; import { fetchIntegration } from '../../src/integrations/fetch'; diff --git a/packages/cloudflare/test/request.test.ts b/packages/cloudflare/test/request.test.ts index d35ccf3d50a7..5218e8afe20b 100644 --- a/packages/cloudflare/test/request.test.ts +++ b/packages/cloudflare/test/request.test.ts @@ -109,7 +109,7 @@ describe('withSentry', () => { }, ); - expect(sentryEvent.sdkProcessingMetadata?.normalizedRequest).toEqual({ + expect(sentryEvent.sdkProcessingMetadata?.request).toEqual({ headers: {}, url: 'https://example.com/', method: 'GET', diff --git a/packages/cloudflare/test/transport.test.ts b/packages/cloudflare/test/transport.test.ts index 069bc119dc37..788785de8216 100644 --- a/packages/cloudflare/test/transport.test.ts +++ b/packages/cloudflare/test/transport.test.ts @@ -1,5 +1,5 @@ -import { createEnvelope, serializeEnvelope } from '@sentry/core'; import type { EventEnvelope, EventItem } from '@sentry/types'; +import { createEnvelope, serializeEnvelope } from '@sentry/utils'; import { afterAll, describe, expect, it, vi } from 'vitest'; import type { CloudflareTransportOptions } from '../src/transport'; diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index 5c0b9f20f693..5a2cc7f1ec08 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -1,4 +1,3 @@ module.exports = { extends: ['../../.eslintrc.js'], - ignorePatterns: ['rollup.npm.config.mjs', 'test/utils-hoist/buildPolyfills/originals.js'], }; diff --git a/packages/core/package.json b/packages/core/package.json index dde9a0f18277..243446361b59 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -39,12 +39,8 @@ "access": "public" }, "dependencies": { - "@sentry/types": "8.39.0" - }, - "TODO(v9):": "Remove these dependencies", - "devDependencies": { - "@types/array.prototype.flat": "^1.2.1", - "array.prototype.flat": "^1.3.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "scripts": { "build": "run-p build:transpile build:types", diff --git a/packages/core/rollup.npm.config.mjs b/packages/core/rollup.npm.config.mjs index cc3ad4064820..d28a7a6f54a0 100644 --- a/packages/core/rollup.npm.config.mjs +++ b/packages/core/rollup.npm.config.mjs @@ -1,19 +1,5 @@ -// @ts-check - -import { readFileSync } from 'fs'; -import { dirname, join } from 'path'; -import { fileURLToPath } from 'url'; -import replace from '@rollup/plugin-replace'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; -const packageJson = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf-8')); - -if (!packageJson.version) { - throw new Error('invariant: package version not found'); -} - -const packageVersion = packageJson.version; - export default makeNPMConfigVariants( makeBaseNPMConfig({ packageSpecificConfig: { @@ -26,14 +12,6 @@ export default makeNPMConfigVariants( ? true : Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES), }, - plugins: [ - replace({ - preventAssignment: true, - values: { - __SENTRY_SDK_VERSION__: JSON.stringify(packageVersion), - }, - }), - ], }, }), ); diff --git a/packages/core/src/api.ts b/packages/core/src/api.ts index f8bb8cfe8eac..f345e14b1514 100644 --- a/packages/core/src/api.ts +++ b/packages/core/src/api.ts @@ -1,6 +1,5 @@ import type { DsnComponents, DsnLike, SdkInfo } from '@sentry/types'; -import { dsnToString, makeDsn } from './utils-hoist/dsn'; -import { urlEncode } from './utils-hoist/object'; +import { dsnToString, makeDsn, urlEncode } from '@sentry/utils'; const SENTRY_API_VERSION = '7'; diff --git a/packages/core/src/asyncContext/stackStrategy.ts b/packages/core/src/asyncContext/stackStrategy.ts index 256efb4a79e2..2681bf95fc5d 100644 --- a/packages/core/src/asyncContext/stackStrategy.ts +++ b/packages/core/src/asyncContext/stackStrategy.ts @@ -1,8 +1,8 @@ import type { Client, Scope as ScopeInterface } from '@sentry/types'; +import { isThenable } from '@sentry/utils'; import { getDefaultCurrentScope, getDefaultIsolationScope } from '../defaultScopes'; import { Scope } from '../scope'; -import { isThenable } from '../utils-hoist'; import { getMainCarrier, getSentryCarrier } from './../carrier'; import type { AsyncContextStrategy } from './types'; diff --git a/packages/core/src/baseclient.ts b/packages/core/src/baseclient.ts index 840992c4ea79..db79df0d1c16 100644 --- a/packages/core/src/baseclient.ts +++ b/packages/core/src/baseclient.ts @@ -30,6 +30,25 @@ import type { Transport, TransportMakeRequestResponse, } from '@sentry/types'; +import { + SentryError, + SyncPromise, + addItemToEnvelope, + checkOrSetAlreadyCaught, + createAttachmentEnvelopeItem, + createClientReportEnvelope, + dropUndefinedKeys, + dsnToString, + isParameterizedString, + isPlainObject, + isPrimitive, + isThenable, + logger, + makeDsn, + rejectedSyncPromise, + resolvedSyncPromise, + uuid4, +} from '@sentry/utils'; import { getEnvelopeEndpointWithUrlEncodedAuth } from './api'; import { getIsolationScope } from './currentScopes'; @@ -41,15 +60,6 @@ import { setupIntegration, setupIntegrations } from './integration'; import type { Scope } from './scope'; import { updateSession } from './session'; import { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext'; -import { createClientReportEnvelope } from './utils-hoist/clientreport'; -import { dsnToString, makeDsn } from './utils-hoist/dsn'; -import { addItemToEnvelope, createAttachmentEnvelopeItem } from './utils-hoist/envelope'; -import { SentryError } from './utils-hoist/error'; -import { isParameterizedString, isPlainObject, isPrimitive, isThenable } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { checkOrSetAlreadyCaught, uuid4 } from './utils-hoist/misc'; -import { dropUndefinedKeys } from './utils-hoist/object'; -import { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './utils-hoist/syncpromise'; import { parseSampleRate } from './utils/parseSampleRate'; import { prepareEvent } from './utils/prepareEvent'; diff --git a/packages/core/src/breadcrumbs.ts b/packages/core/src/breadcrumbs.ts index 2b1f78b50e8d..1cfad5d08fea 100644 --- a/packages/core/src/breadcrumbs.ts +++ b/packages/core/src/breadcrumbs.ts @@ -1,7 +1,6 @@ import type { Breadcrumb, BreadcrumbHint } from '@sentry/types'; +import { consoleSandbox, dateTimestampInSeconds } from '@sentry/utils'; import { getClient, getIsolationScope } from './currentScopes'; -import { consoleSandbox } from './utils-hoist/logger'; -import { dateTimestampInSeconds } from './utils-hoist/time'; /** * Default maximum number of breadcrumbs added to an event. Can be overwritten diff --git a/packages/core/src/carrier.ts b/packages/core/src/carrier.ts index 6f212fc67edb..7442244223ca 100644 --- a/packages/core/src/carrier.ts +++ b/packages/core/src/carrier.ts @@ -1,8 +1,7 @@ import type { Client, Integration, MetricsAggregator, Scope } from '@sentry/types'; +import { GLOBAL_OBJ, SDK_VERSION } from '@sentry/utils'; import type { AsyncContextStack } from './asyncContext/stackStrategy'; import type { AsyncContextStrategy } from './asyncContext/types'; -import { SDK_VERSION } from './utils-hoist/version'; -import { GLOBAL_OBJ } from './utils-hoist/worldwide'; /** * An object that contains globally accessible properties and maintains a scope stack. diff --git a/packages/core/src/checkin.ts b/packages/core/src/checkin.ts index f9e16f8d8cd1..8ffc0d7a60d6 100644 --- a/packages/core/src/checkin.ts +++ b/packages/core/src/checkin.ts @@ -6,9 +6,7 @@ import type { SdkMetadata, SerializedCheckIn, } from '@sentry/types'; -import { dsnToString } from './utils-hoist/dsn'; -import { createEnvelope } from './utils-hoist/envelope'; -import { dropUndefinedKeys } from './utils-hoist/object'; +import { createEnvelope, dropUndefinedKeys, dsnToString } from '@sentry/utils'; /** * Create envelope from check in item. diff --git a/packages/core/src/currentScopes.ts b/packages/core/src/currentScopes.ts index 77e8aa70a02a..317042c08054 100644 --- a/packages/core/src/currentScopes.ts +++ b/packages/core/src/currentScopes.ts @@ -1,9 +1,9 @@ import type { Scope } from '@sentry/types'; import type { Client } from '@sentry/types'; +import { getGlobalSingleton } from '@sentry/utils'; import { getAsyncContextStrategy } from './asyncContext'; import { getMainCarrier } from './carrier'; import { Scope as ScopeClass } from './scope'; -import { getGlobalSingleton } from './utils-hoist/worldwide'; /** * Get the currently active scope. diff --git a/packages/core/src/defaultScopes.ts b/packages/core/src/defaultScopes.ts index fa2f4700fdf9..d346ca7ad4dc 100644 --- a/packages/core/src/defaultScopes.ts +++ b/packages/core/src/defaultScopes.ts @@ -1,6 +1,6 @@ import type { Scope } from '@sentry/types'; +import { getGlobalSingleton } from '@sentry/utils'; import { Scope as ScopeClass } from './scope'; -import { getGlobalSingleton } from './utils-hoist/worldwide'; /** Get the default current scope. */ export function getDefaultCurrentScope(): Scope { diff --git a/packages/core/src/envelope.ts b/packages/core/src/envelope.ts index ddeb2ce21997..efe55ab685ac 100644 --- a/packages/core/src/envelope.ts +++ b/packages/core/src/envelope.ts @@ -15,15 +15,15 @@ import type { SpanItem, SpanJSON, } from '@sentry/types'; -import { getDynamicSamplingContextFromSpan } from './tracing/dynamicSamplingContext'; -import type { SentrySpan } from './tracing/sentrySpan'; -import { dsnToString } from './utils-hoist/dsn'; import { createEnvelope, createEventEnvelopeHeaders, - createSpanEnvelopeItem, + dsnToString, getSdkMetadataForEnvelopeHeader, -} from './utils-hoist/envelope'; +} from '@sentry/utils'; +import { createSpanEnvelopeItem } from '@sentry/utils'; +import { getDynamicSamplingContextFromSpan } from './tracing/dynamicSamplingContext'; +import type { SentrySpan } from './tracing/sentrySpan'; import { spanToJSON } from './utils/spanUtils'; /** diff --git a/packages/core/src/eventProcessors.ts b/packages/core/src/eventProcessors.ts index 5886384879c5..2f648ba608e2 100644 --- a/packages/core/src/eventProcessors.ts +++ b/packages/core/src/eventProcessors.ts @@ -1,9 +1,7 @@ import type { Event, EventHint, EventProcessor } from '@sentry/types'; +import { SyncPromise, isThenable, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; -import { isThenable } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { SyncPromise } from './utils-hoist/syncpromise'; /** * Process an array of event processors, returning the processed event (or `null` if the event was dropped). diff --git a/packages/core/src/exports.ts b/packages/core/src/exports.ts index 5e2be168487c..8235e855903d 100644 --- a/packages/core/src/exports.ts +++ b/packages/core/src/exports.ts @@ -14,16 +14,12 @@ import type { SeverityLevel, User, } from '@sentry/types'; +import { GLOBAL_OBJ, isThenable, logger, timestampInSeconds, uuid4 } from '@sentry/utils'; import { DEFAULT_ENVIRONMENT } from './constants'; import { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; import { closeSession, makeSession, updateSession } from './session'; -import { isThenable } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { uuid4 } from './utils-hoist/misc'; -import { timestampInSeconds } from './utils-hoist/time'; -import { GLOBAL_OBJ } from './utils-hoist/worldwide'; import type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent'; import { parseEventHintOrCaptureContext } from './utils/prepareEvent'; diff --git a/packages/core/src/feedback.ts b/packages/core/src/feedback.ts index e49f8ddc27a9..4920842e2114 100644 --- a/packages/core/src/feedback.ts +++ b/packages/core/src/feedback.ts @@ -1,6 +1,6 @@ import type { EventHint, FeedbackEvent, SendFeedbackParams } from '@sentry/types'; +import { dropUndefinedKeys } from '@sentry/utils'; import { getClient, getCurrentScope } from './currentScopes'; -import { dropUndefinedKeys } from './utils-hoist/object'; /** * Send user feedback to Sentry. diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index 5880d2594baa..29ff5d074cd0 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -1,4 +1,12 @@ import type { Client, HandlerDataFetch, Scope, Span, SpanOrigin } from '@sentry/types'; +import { + BAGGAGE_HEADER_NAME, + SENTRY_BAGGAGE_KEY_PREFIX, + dynamicSamplingContextToSentryBaggageHeader, + generateSentryTraceHeader, + isInstanceOf, + parseUrl, +} from '@sentry/utils'; import { getClient, getCurrentScope, getIsolationScope } from './currentScopes'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from './semanticAttributes'; import { @@ -9,14 +17,6 @@ import { startInactiveSpan, } from './tracing'; import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan'; -import { - BAGGAGE_HEADER_NAME, - SENTRY_BAGGAGE_KEY_PREFIX, - dynamicSamplingContextToSentryBaggageHeader, -} from './utils-hoist/baggage'; -import { isInstanceOf } from './utils-hoist/is'; -import { generateSentryTraceHeader } from './utils-hoist/tracing'; -import { parseUrl } from './utils-hoist/url'; import { hasTracingEnabled } from './utils/hasTracingEnabled'; import { getActiveSpan, spanToTraceHeader } from './utils/spanUtils'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index c56c568d092f..598b0168f3ef 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,5 +1,3 @@ -// TODO(v9): Don't have this file be in the "utils-hoist" folder but "utils" folder - it's cleaner - export type { ClientClass as SentryCoreCurrentScopes } from './sdk'; export type { AsyncContextStrategy } from './asyncContext/types'; export type { Carrier } from './carrier'; @@ -94,12 +92,10 @@ export { linkedErrorsIntegration } from './integrations/linkederrors'; export { moduleMetadataIntegration } from './integrations/metadata'; export { requestDataIntegration } from './integrations/requestdata'; export { captureConsoleIntegration } from './integrations/captureconsole'; -// eslint-disable-next-line deprecation/deprecation export { debugIntegration } from './integrations/debug'; export { dedupeIntegration } from './integrations/dedupe'; export { extraErrorDataIntegration } from './integrations/extraerrordata'; export { rewriteFramesIntegration } from './integrations/rewriteframes'; -// eslint-disable-next-line deprecation/deprecation export { sessionTimingIntegration } from './integrations/sessiontiming'; export { zodErrorsIntegration } from './integrations/zoderrors'; export { thirdPartyErrorFilterIntegration } from './integrations/third-party-errors-filter'; @@ -118,4 +114,4 @@ export { captureFeedback } from './feedback'; // eslint-disable-next-line deprecation/deprecation export { getCurrentHubShim, getCurrentHub } from './getCurrentHubShim'; -export * from './utils-hoist/index'; +export { SDK_VERSION } from '@sentry/utils'; diff --git a/packages/core/src/integration.ts b/packages/core/src/integration.ts index 9f447163d8f0..500b717c3487 100644 --- a/packages/core/src/integration.ts +++ b/packages/core/src/integration.ts @@ -1,8 +1,8 @@ import type { Client, Event, EventHint, Integration, IntegrationFn, Options } from '@sentry/types'; +import { arrayify, logger } from '@sentry/utils'; import { getClient } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; -import { logger } from './utils-hoist/logger'; declare module '@sentry/types' { interface Integration { @@ -58,8 +58,7 @@ export function getIntegrationsToSetup(options: Pick { const _options = { debugger: false, @@ -47,11 +51,4 @@ const _debugIntegration = ((options: DebugOptions = {}) => { }; }) satisfies IntegrationFn; -/** - * Integration to debug sent Sentry events. - * This integration should not be used in production. - * - * @deprecated This integration is deprecated and will be removed in the next major version of the SDK. - * To log outgoing events, use [Hook Options](https://docs.sentry.io/platforms/javascript/configuration/options/#hooks) (`beforeSend`, `beforeSendTransaction`, ...). - */ export const debugIntegration = defineIntegration(_debugIntegration); diff --git a/packages/core/src/integrations/dedupe.ts b/packages/core/src/integrations/dedupe.ts index d0a3b75e9f0c..32507f3a22ee 100644 --- a/packages/core/src/integrations/dedupe.ts +++ b/packages/core/src/integrations/dedupe.ts @@ -1,9 +1,8 @@ import type { Event, Exception, IntegrationFn, StackFrame } from '@sentry/types'; +import { getFramesFromEvent, logger } from '@sentry/utils'; import { defineIntegration } from '../integration'; import { DEBUG_BUILD } from '../debug-build'; -import { logger } from '../utils-hoist/logger'; -import { getFramesFromEvent } from '../utils-hoist/stacktrace'; const INTEGRATION_NAME = 'Dedupe'; diff --git a/packages/core/src/integrations/extraerrordata.ts b/packages/core/src/integrations/extraerrordata.ts index d56d82daa2c1..853b19cef6f9 100644 --- a/packages/core/src/integrations/extraerrordata.ts +++ b/packages/core/src/integrations/extraerrordata.ts @@ -1,12 +1,8 @@ import type { Contexts, Event, EventHint, ExtendedError, IntegrationFn } from '@sentry/types'; +import { addNonEnumerableProperty, isError, isPlainObject, logger, normalize, truncate } from '@sentry/utils'; import { defineIntegration } from '../integration'; import { DEBUG_BUILD } from '../debug-build'; -import { isError, isPlainObject } from '../utils-hoist/is'; -import { logger } from '../utils-hoist/logger'; -import { normalize } from '../utils-hoist/normalize'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; -import { truncate } from '../utils-hoist/string'; const INTEGRATION_NAME = 'ExtraErrorData'; diff --git a/packages/core/src/integrations/functiontostring.ts b/packages/core/src/integrations/functiontostring.ts index b43c882f381f..ea04d3ff334d 100644 --- a/packages/core/src/integrations/functiontostring.ts +++ b/packages/core/src/integrations/functiontostring.ts @@ -1,7 +1,7 @@ import type { Client, IntegrationFn, WrappedFunction } from '@sentry/types'; +import { getOriginalFunction } from '@sentry/utils'; import { getClient } from '../currentScopes'; import { defineIntegration } from '../integration'; -import { getOriginalFunction } from '../utils-hoist/object'; let originalFunctionToString: () => void; diff --git a/packages/core/src/integrations/inboundfilters.ts b/packages/core/src/integrations/inboundfilters.ts index f03068cabf26..2dd87b5f91bf 100644 --- a/packages/core/src/integrations/inboundfilters.ts +++ b/packages/core/src/integrations/inboundfilters.ts @@ -1,10 +1,8 @@ import type { Event, IntegrationFn, StackFrame } from '@sentry/types'; +import { getEventDescription, logger, stringMatchesSomePattern } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { defineIntegration } from '../integration'; -import { logger } from '../utils-hoist/logger'; -import { getEventDescription } from '../utils-hoist/misc'; -import { stringMatchesSomePattern } from '../utils-hoist/string'; // "Script error." is hard coded into browsers for errors that it can't read. // this is the result of a script being pulled in from an external domain and CORS. diff --git a/packages/core/src/integrations/linkederrors.ts b/packages/core/src/integrations/linkederrors.ts index fc2f62ec120e..d5d4d03f9e90 100644 --- a/packages/core/src/integrations/linkederrors.ts +++ b/packages/core/src/integrations/linkederrors.ts @@ -1,7 +1,6 @@ import type { IntegrationFn } from '@sentry/types'; +import { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils'; import { defineIntegration } from '../integration'; -import { applyAggregateErrorsToEvent } from '../utils-hoist/aggregate-errors'; -import { exceptionFromError } from '../utils-hoist/eventbuilder'; interface LinkedErrorsOptions { key?: string; diff --git a/packages/core/src/integrations/metadata.ts b/packages/core/src/integrations/metadata.ts index 1f02b57461b5..0bf11746dc1b 100644 --- a/packages/core/src/integrations/metadata.ts +++ b/packages/core/src/integrations/metadata.ts @@ -1,8 +1,8 @@ import type { EventItem } from '@sentry/types'; +import { forEachEnvelopeItem } from '@sentry/utils'; import { defineIntegration } from '../integration'; import { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata'; -import { forEachEnvelopeItem } from '../utils-hoist/envelope'; /** * Adds module metadata to stack frames. diff --git a/packages/core/src/integrations/requestdata.ts b/packages/core/src/integrations/requestdata.ts index ae016959d9c3..15be450cf27e 100644 --- a/packages/core/src/integrations/requestdata.ts +++ b/packages/core/src/integrations/requestdata.ts @@ -1,10 +1,8 @@ import type { IntegrationFn } from '@sentry/types'; +import type { AddRequestDataToEventOptions, TransactionNamingScheme } from '@sentry/utils'; +import { addNormalizedRequestDataToEvent } from '@sentry/utils'; +import { addRequestDataToEvent } from '@sentry/utils'; import { defineIntegration } from '../integration'; -import { - type AddRequestDataToEventOptions, - addNormalizedRequestDataToEvent, - addRequestDataToEvent, -} from '../utils-hoist/requestdata'; export type RequestDataIntegrationOptions = { /** @@ -30,7 +28,8 @@ export type RequestDataIntegrationOptions = { * Whether to identify transactions by parameterized path, parameterized path with method, or handler name. * @deprecated This option does not do anything anymore, and will be removed in v9. */ - transactionNamingScheme?: 'path' | 'methodPath' | 'handler'; + // eslint-disable-next-line deprecation/deprecation + transactionNamingScheme?: TransactionNamingScheme; }; const DEFAULT_OPTIONS = { diff --git a/packages/core/src/integrations/rewriteframes.ts b/packages/core/src/integrations/rewriteframes.ts index 88e9038cfd47..3b81d141cdad 100644 --- a/packages/core/src/integrations/rewriteframes.ts +++ b/packages/core/src/integrations/rewriteframes.ts @@ -1,7 +1,6 @@ import type { Event, StackFrame, Stacktrace } from '@sentry/types'; +import { GLOBAL_OBJ, basename, relative } from '@sentry/utils'; import { defineIntegration } from '../integration'; -import { basename, relative } from '../utils-hoist/path'; -import { GLOBAL_OBJ } from '../utils-hoist/worldwide'; type StackFrameIteratee = (frame: StackFrame) => StackFrame; diff --git a/packages/core/src/integrations/sessiontiming.ts b/packages/core/src/integrations/sessiontiming.ts index e52cb3c97482..4664893915e0 100644 --- a/packages/core/src/integrations/sessiontiming.ts +++ b/packages/core/src/integrations/sessiontiming.ts @@ -1,6 +1,6 @@ import type { IntegrationFn } from '@sentry/types'; +import { timestampInSeconds } from '@sentry/utils'; import { defineIntegration } from '../integration'; -import { timestampInSeconds } from '../utils-hoist/time'; const INTEGRATION_NAME = 'SessionTiming'; @@ -28,8 +28,5 @@ const _sessionTimingIntegration = (() => { /** * This function adds duration since the sessionTimingIntegration was initialized * till the time event was sent. - * - * @deprecated This integration is deprecated and will be removed in the next major version of the SDK. - * To capture session durations alongside events, use [Context](https://docs.sentry.io/platforms/javascript/enriching-events/context/) (`Sentry.setContext()`). */ export const sessionTimingIntegration = defineIntegration(_sessionTimingIntegration); diff --git a/packages/core/src/integrations/third-party-errors-filter.ts b/packages/core/src/integrations/third-party-errors-filter.ts index 5e64a8736826..652ca23a6da6 100644 --- a/packages/core/src/integrations/third-party-errors-filter.ts +++ b/packages/core/src/integrations/third-party-errors-filter.ts @@ -1,8 +1,7 @@ import type { Event, EventItem } from '@sentry/types'; +import { forEachEnvelopeItem, getFramesFromEvent } from '@sentry/utils'; import { defineIntegration } from '../integration'; import { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata'; -import { forEachEnvelopeItem } from '../utils-hoist/envelope'; -import { getFramesFromEvent } from '../utils-hoist/stacktrace'; interface Options { /** diff --git a/packages/core/src/integrations/zoderrors.ts b/packages/core/src/integrations/zoderrors.ts index 1c2cb8e59b56..6dc583e54235 100644 --- a/packages/core/src/integrations/zoderrors.ts +++ b/packages/core/src/integrations/zoderrors.ts @@ -1,8 +1,7 @@ import type { IntegrationFn } from '@sentry/types'; import type { Event, EventHint } from '@sentry/types'; +import { isError, truncate } from '@sentry/utils'; import { defineIntegration } from '../integration'; -import { isError } from '../utils-hoist/is'; -import { truncate } from '../utils-hoist/string'; interface ZodErrorsOptions { key?: string; diff --git a/packages/core/src/metadata.ts b/packages/core/src/metadata.ts index 11a0af6eaadb..c13a5dabce34 100644 --- a/packages/core/src/metadata.ts +++ b/packages/core/src/metadata.ts @@ -1,5 +1,5 @@ import type { Event, StackParser } from '@sentry/types'; -import { GLOBAL_OBJ } from './utils-hoist/worldwide'; +import { GLOBAL_OBJ } from '@sentry/utils'; /** Keys are source filename/url, values are metadata objects. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/core/src/metrics/aggregator.ts b/packages/core/src/metrics/aggregator.ts index 0fee0551fc66..c87fd14e34f9 100644 --- a/packages/core/src/metrics/aggregator.ts +++ b/packages/core/src/metrics/aggregator.ts @@ -1,5 +1,5 @@ import type { Client, MeasurementUnit, MetricsAggregator as MetricsAggregatorBase, Primitive } from '@sentry/types'; -import { timestampInSeconds } from '../utils-hoist/time'; +import { timestampInSeconds } from '@sentry/utils'; import { updateMetricSummaryOnActiveSpan } from '../utils/spanUtils'; import { DEFAULT_FLUSH_INTERVAL, MAX_WEIGHT, SET_METRIC_TYPE } from './constants'; import { captureAggregateMetrics } from './envelope'; diff --git a/packages/core/src/metrics/browser-aggregator.ts b/packages/core/src/metrics/browser-aggregator.ts index 0818f691f313..e087b45ca010 100644 --- a/packages/core/src/metrics/browser-aggregator.ts +++ b/packages/core/src/metrics/browser-aggregator.ts @@ -1,5 +1,5 @@ import type { Client, MeasurementUnit, MetricsAggregator, Primitive } from '@sentry/types'; -import { timestampInSeconds } from '../utils-hoist/time'; +import { timestampInSeconds } from '@sentry/utils'; import { updateMetricSummaryOnActiveSpan } from '../utils/spanUtils'; import { DEFAULT_BROWSER_FLUSH_INTERVAL, SET_METRIC_TYPE } from './constants'; import { captureAggregateMetrics } from './envelope'; diff --git a/packages/core/src/metrics/envelope.ts b/packages/core/src/metrics/envelope.ts index 8924df587771..f3bd67b27ec6 100644 --- a/packages/core/src/metrics/envelope.ts +++ b/packages/core/src/metrics/envelope.ts @@ -1,7 +1,5 @@ import type { Client, DsnComponents, MetricBucketItem, SdkMetadata, StatsdEnvelope, StatsdItem } from '@sentry/types'; -import { dsnToString } from '../utils-hoist/dsn'; -import { createEnvelope } from '../utils-hoist/envelope'; -import { logger } from '../utils-hoist/logger'; +import { createEnvelope, dsnToString, logger } from '@sentry/utils'; import { serializeMetricBuckets } from './utils'; /** diff --git a/packages/core/src/metrics/exports.ts b/packages/core/src/metrics/exports.ts index 96a52f62e5c9..2b3cdbcef8ba 100644 --- a/packages/core/src/metrics/exports.ts +++ b/packages/core/src/metrics/exports.ts @@ -1,10 +1,8 @@ import type { Client, DurationUnit, MetricData, MetricsAggregator as MetricsAggregatorInterface } from '@sentry/types'; +import { getGlobalSingleton, logger, timestampInSeconds } from '@sentry/utils'; import { getClient } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; import { startSpanManual } from '../tracing'; -import { logger } from '../utils-hoist/logger'; -import { timestampInSeconds } from '../utils-hoist/time'; -import { getGlobalSingleton } from '../utils-hoist/worldwide'; import { handleCallbackErrors } from '../utils/handleCallbackErrors'; import { getActiveSpan, getRootSpan, spanToJSON } from '../utils/spanUtils'; import { COUNTER_METRIC_TYPE, DISTRIBUTION_METRIC_TYPE, GAUGE_METRIC_TYPE, SET_METRIC_TYPE } from './constants'; diff --git a/packages/core/src/metrics/metric-summary.ts b/packages/core/src/metrics/metric-summary.ts index 90a3365ccdaf..279bea9e0808 100644 --- a/packages/core/src/metrics/metric-summary.ts +++ b/packages/core/src/metrics/metric-summary.ts @@ -1,7 +1,7 @@ import type { MeasurementUnit, Span } from '@sentry/types'; import type { MetricSummary } from '@sentry/types'; import type { Primitive } from '@sentry/types'; -import { dropUndefinedKeys } from '../utils-hoist/object'; +import { dropUndefinedKeys } from '@sentry/utils'; import type { MetricType } from './types'; /** diff --git a/packages/core/src/metrics/utils.ts b/packages/core/src/metrics/utils.ts index 06df4a96bced..bc1ff93e0002 100644 --- a/packages/core/src/metrics/utils.ts +++ b/packages/core/src/metrics/utils.ts @@ -1,5 +1,5 @@ import type { MeasurementUnit, MetricBucketItem, Primitive } from '@sentry/types'; -import { dropUndefinedKeys } from '../utils-hoist/object'; +import { dropUndefinedKeys } from '@sentry/utils'; import type { MetricType } from './types'; /** diff --git a/packages/core/src/profiling.ts b/packages/core/src/profiling.ts index 877f9d71ac15..446eebb73671 100644 --- a/packages/core/src/profiling.ts +++ b/packages/core/src/profiling.ts @@ -1,8 +1,8 @@ import type { Profiler, ProfilingIntegration } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { getClient } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; -import { logger } from './utils-hoist/logger'; function isProfilingIntegrationWithProfiler( integration: ProfilingIntegration | undefined, diff --git a/packages/core/src/scope.ts b/packages/core/src/scope.ts index e03f378cac20..ff89c0d593a9 100644 --- a/packages/core/src/scope.ts +++ b/packages/core/src/scope.ts @@ -21,14 +21,9 @@ import type { SeverityLevel, User, } from '@sentry/types'; +import { dateTimestampInSeconds, generatePropagationContext, isPlainObject, logger, uuid4 } from '@sentry/utils'; import { updateSession } from './session'; -import { isPlainObject } from './utils-hoist/is'; -import { logger } from './utils-hoist/logger'; -import { uuid4 } from './utils-hoist/misc'; -import { generatePropagationContext } from './utils-hoist/propagationContext'; -import { dateTimestampInSeconds } from './utils-hoist/time'; -import { merge } from './utils/merge'; import { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope'; /** @@ -484,7 +479,8 @@ class ScopeClass implements ScopeInterface { * @inheritDoc */ public setSDKProcessingMetadata(newData: { [key: string]: unknown }): this { - this._sdkProcessingMetadata = merge(this._sdkProcessingMetadata, newData, 2); + this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData }; + return this; } diff --git a/packages/core/src/sdk.ts b/packages/core/src/sdk.ts index 82895b9a03f9..d78f8f253186 100644 --- a/packages/core/src/sdk.ts +++ b/packages/core/src/sdk.ts @@ -1,8 +1,8 @@ import type { Client, ClientOptions } from '@sentry/types'; +import { consoleSandbox, logger } from '@sentry/utils'; import { getCurrentScope } from './currentScopes'; import { DEBUG_BUILD } from './debug-build'; -import { consoleSandbox, logger } from './utils-hoist/logger'; /** A class object that can instantiate Client objects. */ export type ClientClass = new (options: O) => F; diff --git a/packages/core/src/server-runtime-client.ts b/packages/core/src/server-runtime-client.ts index 93c1051ed6ec..6d1a3683b05b 100644 --- a/packages/core/src/server-runtime-client.ts +++ b/packages/core/src/server-runtime-client.ts @@ -11,6 +11,7 @@ import type { SeverityLevel, TraceContext, } from '@sentry/types'; +import { eventFromMessage, eventFromUnknownInput, logger, resolvedSyncPromise, uuid4 } from '@sentry/utils'; import { BaseClient } from './baseclient'; import { createCheckInEnvelope } from './checkin'; @@ -23,10 +24,6 @@ import { getDynamicSamplingContextFromSpan, registerSpanErrorInstrumentation, } from './tracing'; -import { eventFromMessage, eventFromUnknownInput } from './utils-hoist/eventbuilder'; -import { logger } from './utils-hoist/logger'; -import { uuid4 } from './utils-hoist/misc'; -import { resolvedSyncPromise } from './utils-hoist/syncpromise'; import { _getSpanForScope } from './utils/spanOnScope'; import { getRootSpan, spanToTraceContext } from './utils/spanUtils'; diff --git a/packages/core/src/session.ts b/packages/core/src/session.ts index bf584482e87b..4d3786bab9c5 100644 --- a/packages/core/src/session.ts +++ b/packages/core/src/session.ts @@ -1,6 +1,5 @@ import type { SerializedSession, Session, SessionContext, SessionStatus } from '@sentry/types'; -import { dropUndefinedKeys, timestampInSeconds, uuid4 } from './utils-hoist'; - +import { dropUndefinedKeys, timestampInSeconds, uuid4 } from '@sentry/utils'; /** * Creates a new `Session` object by setting certain default parameters. If optional @param context * is passed, the passed properties are applied to the session object. diff --git a/packages/core/src/sessionflusher.ts b/packages/core/src/sessionflusher.ts index 8734c0de2f12..02c93791007e 100644 --- a/packages/core/src/sessionflusher.ts +++ b/packages/core/src/sessionflusher.ts @@ -5,8 +5,8 @@ import type { SessionAggregates, SessionFlusherLike, } from '@sentry/types'; +import { dropUndefinedKeys } from '@sentry/utils'; import { getIsolationScope } from './currentScopes'; -import { dropUndefinedKeys } from './utils-hoist/object'; type ReleaseHealthAttributes = { environment?: string; diff --git a/packages/core/src/tracing/dynamicSamplingContext.ts b/packages/core/src/tracing/dynamicSamplingContext.ts index 1e8ca0448b3b..d96dd726d51f 100644 --- a/packages/core/src/tracing/dynamicSamplingContext.ts +++ b/packages/core/src/tracing/dynamicSamplingContext.ts @@ -1,13 +1,14 @@ import type { Client, DynamicSamplingContext, Span } from '@sentry/types'; +import { + addNonEnumerableProperty, + baggageHeaderToDynamicSamplingContext, + dropUndefinedKeys, + dynamicSamplingContextToSentryBaggageHeader, +} from '@sentry/utils'; import { DEFAULT_ENVIRONMENT } from '../constants'; import { getClient } from '../currentScopes'; import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../semanticAttributes'; -import { - baggageHeaderToDynamicSamplingContext, - dynamicSamplingContextToSentryBaggageHeader, -} from '../utils-hoist/baggage'; -import { addNonEnumerableProperty, dropUndefinedKeys } from '../utils-hoist/object'; import { hasTracingEnabled } from '../utils/hasTracingEnabled'; import { getRootSpan, spanIsSampled, spanToJSON } from '../utils/spanUtils'; diff --git a/packages/core/src/tracing/errors.ts b/packages/core/src/tracing/errors.ts index 6c7f894a60b6..a611dd1d80e4 100644 --- a/packages/core/src/tracing/errors.ts +++ b/packages/core/src/tracing/errors.ts @@ -1,7 +1,10 @@ +import { + addGlobalErrorInstrumentationHandler, + addGlobalUnhandledRejectionInstrumentationHandler, + logger, +} from '@sentry/utils'; + import { DEBUG_BUILD } from '../debug-build'; -import { addGlobalErrorInstrumentationHandler } from '../utils-hoist/instrument/globalError'; -import { addGlobalUnhandledRejectionInstrumentationHandler } from '../utils-hoist/instrument/globalUnhandledRejection'; -import { logger } from '../utils-hoist/logger'; import { getActiveSpan, getRootSpan } from '../utils/spanUtils'; import { SPAN_STATUS_ERROR } from './spanstatus'; diff --git a/packages/core/src/tracing/idleSpan.ts b/packages/core/src/tracing/idleSpan.ts index 6a6dd12fc6e8..3a9b705dd449 100644 --- a/packages/core/src/tracing/idleSpan.ts +++ b/packages/core/src/tracing/idleSpan.ts @@ -1,10 +1,9 @@ import type { Span, SpanAttributes, StartSpanOptions } from '@sentry/types'; +import { logger, timestampInSeconds } from '@sentry/utils'; import { getClient, getCurrentScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; import { SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON } from '../semanticAttributes'; -import { logger } from '../utils-hoist/logger'; -import { timestampInSeconds } from '../utils-hoist/time'; import { hasTracingEnabled } from '../utils/hasTracingEnabled'; import { _setSpanForScope } from '../utils/spanOnScope'; import { diff --git a/packages/core/src/tracing/logSpans.ts b/packages/core/src/tracing/logSpans.ts index f7b0522bf6dc..11a83c6b7a41 100644 --- a/packages/core/src/tracing/logSpans.ts +++ b/packages/core/src/tracing/logSpans.ts @@ -1,6 +1,6 @@ import type { Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; -import { logger } from '../utils-hoist/logger'; import { getRootSpan, spanIsSampled, spanToJSON } from '../utils/spanUtils'; /** diff --git a/packages/core/src/tracing/sampling.ts b/packages/core/src/tracing/sampling.ts index de737d3d5776..1f8e0d0eda83 100644 --- a/packages/core/src/tracing/sampling.ts +++ b/packages/core/src/tracing/sampling.ts @@ -1,7 +1,7 @@ import type { Options, SamplingContext } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; -import { logger } from '../utils-hoist/logger'; import { hasTracingEnabled } from '../utils/hasTracingEnabled'; import { parseSampleRate } from '../utils/parseSampleRate'; diff --git a/packages/core/src/tracing/sentryNonRecordingSpan.ts b/packages/core/src/tracing/sentryNonRecordingSpan.ts index 6f1365671bc0..c39730faf9c5 100644 --- a/packages/core/src/tracing/sentryNonRecordingSpan.ts +++ b/packages/core/src/tracing/sentryNonRecordingSpan.ts @@ -7,7 +7,7 @@ import type { SpanStatus, SpanTimeInput, } from '@sentry/types'; -import { uuid4 } from '../utils-hoist/misc'; +import { uuid4 } from '@sentry/utils'; import { TRACE_FLAG_NONE } from '../utils/spanUtils'; /** diff --git a/packages/core/src/tracing/sentrySpan.ts b/packages/core/src/tracing/sentrySpan.ts index 4e0b0fb07e73..4f0096b29773 100644 --- a/packages/core/src/tracing/sentrySpan.ts +++ b/packages/core/src/tracing/sentrySpan.ts @@ -13,6 +13,7 @@ import type { TransactionEvent, TransactionSource, } from '@sentry/types'; +import { dropUndefinedKeys, logger, timestampInSeconds, uuid4 } from '@sentry/utils'; import { getClient, getCurrentScope } from '../currentScopes'; import { DEBUG_BUILD } from '../debug-build'; @@ -25,10 +26,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '../semanticAttributes'; -import { logger } from '../utils-hoist/logger'; -import { uuid4 } from '../utils-hoist/misc'; -import { dropUndefinedKeys } from '../utils-hoist/object'; -import { timestampInSeconds } from '../utils-hoist/time'; import { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, diff --git a/packages/core/src/tracing/trace.ts b/packages/core/src/tracing/trace.ts index cac212246f36..0cb98082c590 100644 --- a/packages/core/src/tracing/trace.ts +++ b/packages/core/src/tracing/trace.ts @@ -1,6 +1,7 @@ /* eslint-disable max-lines */ import type { ClientOptions, Scope, SentrySpanArguments, Span, SpanTimeInput, StartSpanOptions } from '@sentry/types'; +import { generatePropagationContext, logger, propagationContextFromHeaders } from '@sentry/utils'; import type { AsyncContextStrategy } from '../asyncContext/types'; import { getMainCarrier } from '../carrier'; @@ -9,9 +10,6 @@ import { getClient, getCurrentScope, getIsolationScope, withScope } from '../cur import { getAsyncContextStrategy } from '../asyncContext'; import { DEBUG_BUILD } from '../debug-build'; import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '../semanticAttributes'; -import { logger } from '../utils-hoist/logger'; -import { generatePropagationContext } from '../utils-hoist/propagationContext'; -import { propagationContextFromHeaders } from '../utils-hoist/tracing'; import { handleCallbackErrors } from '../utils/handleCallbackErrors'; import { hasTracingEnabled } from '../utils/hasTracingEnabled'; import { _getSpanForScope, _setSpanForScope } from '../utils/spanOnScope'; diff --git a/packages/core/src/tracing/utils.ts b/packages/core/src/tracing/utils.ts index 80ad6762dfb8..28ba9fb271eb 100644 --- a/packages/core/src/tracing/utils.ts +++ b/packages/core/src/tracing/utils.ts @@ -1,6 +1,9 @@ import type { Span } from '@sentry/types'; import type { Scope } from '@sentry/types'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; +import { addNonEnumerableProperty } from '@sentry/utils'; + +// so it can be used in manual instrumentation without necessitating a hard dependency on @sentry/utils +export { stripUrlQueryAndFragment } from '@sentry/utils'; const SCOPE_ON_START_SPAN_FIELD = '_sentryScope'; const ISOLATION_SCOPE_ON_START_SPAN_FIELD = '_sentryIsolationScope'; diff --git a/packages/core/src/transports/base.ts b/packages/core/src/transports/base.ts index d2f02fc32a82..965125590896 100644 --- a/packages/core/src/transports/base.ts +++ b/packages/core/src/transports/base.ts @@ -10,19 +10,21 @@ import type { TransportMakeRequestResponse, TransportRequestExecutor, } from '@sentry/types'; - -import { DEBUG_BUILD } from '../debug-build'; +import type { PromiseBuffer, RateLimits } from '@sentry/utils'; import { + SentryError, createEnvelope, envelopeItemTypeToDataCategory, forEachEnvelopeItem, + isRateLimited, + logger, + makePromiseBuffer, + resolvedSyncPromise, serializeEnvelope, -} from '../utils-hoist/envelope'; -import { SentryError } from '../utils-hoist/error'; -import { logger } from '../utils-hoist/logger'; -import { type PromiseBuffer, makePromiseBuffer } from '../utils-hoist/promisebuffer'; -import { type RateLimits, isRateLimited, updateRateLimits } from '../utils-hoist/ratelimit'; -import { resolvedSyncPromise } from '../utils-hoist/syncpromise'; + updateRateLimits, +} from '@sentry/utils'; + +import { DEBUG_BUILD } from '../debug-build'; export const DEFAULT_TRANSPORT_BUFFER_SIZE = 64; diff --git a/packages/core/src/transports/multiplexed.ts b/packages/core/src/transports/multiplexed.ts index afb839b15863..6b58637025dd 100644 --- a/packages/core/src/transports/multiplexed.ts +++ b/packages/core/src/transports/multiplexed.ts @@ -7,10 +7,9 @@ import type { Transport, TransportMakeRequestResponse, } from '@sentry/types'; +import { createEnvelope, dsnFromString, forEachEnvelopeItem } from '@sentry/utils'; import { getEnvelopeEndpointWithUrlEncodedAuth } from '../api'; -import { dsnFromString } from '../utils-hoist/dsn'; -import { createEnvelope, forEachEnvelopeItem } from '../utils-hoist/envelope'; interface MatchParam { /** The envelope to be sent */ diff --git a/packages/core/src/transports/offline.ts b/packages/core/src/transports/offline.ts index f8d3196dd7b5..9d30b8cb34ec 100644 --- a/packages/core/src/transports/offline.ts +++ b/packages/core/src/transports/offline.ts @@ -1,9 +1,7 @@ import type { Envelope, InternalBaseTransportOptions, Transport, TransportMakeRequestResponse } from '@sentry/types'; +import { envelopeContainsItemType, logger, parseRetryAfterHeader } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; -import { envelopeContainsItemType } from '../utils-hoist/envelope'; -import { logger } from '../utils-hoist/logger'; -import { parseRetryAfterHeader } from '../utils-hoist/ratelimit'; export const MIN_DELAY = 100; // 100 ms export const START_DELAY = 5_000; // 5 seconds diff --git a/packages/core/src/trpc.ts b/packages/core/src/trpc.ts index eddabd123250..fbcdf5832b46 100644 --- a/packages/core/src/trpc.ts +++ b/packages/core/src/trpc.ts @@ -1,8 +1,9 @@ +import { normalize } from '@sentry/utils'; + import { getClient, withScope } from './currentScopes'; import { captureException } from './exports'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes'; import { startSpanManual } from './tracing'; -import { normalize } from './utils-hoist/normalize'; interface SentryTrpcMiddlewareOptions { /** Whether to include procedure inputs in reported events. Defaults to `false`. */ diff --git a/packages/core/src/utils-hoist/index.ts b/packages/core/src/utils-hoist/index.ts deleted file mode 100644 index 1625ea6c0868..000000000000 --- a/packages/core/src/utils-hoist/index.ts +++ /dev/null @@ -1,171 +0,0 @@ -export { applyAggregateErrorsToEvent } from './aggregate-errors'; -export { flatten } from './array'; -export { getBreadcrumbLogLevelFromHttpStatusCode } from './breadcrumb-log-level'; -export { getComponentName, getDomElement, getLocationHref, htmlTreeAsString } from './browser'; -export { dsnFromString, dsnToString, makeDsn } from './dsn'; -export { SentryError } from './error'; -export { GLOBAL_OBJ, getGlobalSingleton } from './worldwide'; -export type { InternalGlobal } from './worldwide'; -export { addConsoleInstrumentationHandler } from './instrument/console'; -export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; -export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; -export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection'; -export { - addHandler, - maybeInstrument, - resetInstrumentationHandlers, - triggerHandlers, -} from './instrument/handlers'; -export { - isDOMError, - isDOMException, - isElement, - isError, - isErrorEvent, - isEvent, - isInstanceOf, - isParameterizedString, - isPlainObject, - isPrimitive, - isRegExp, - isString, - isSyntheticEvent, - isThenable, - isVueViewModel, -} from './is'; -export { isBrowser } from './isBrowser'; -export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods } from './logger'; -export { memoBuilder } from './memo'; -export { - addContextToFrame, - addExceptionMechanism, - addExceptionTypeValue, - arrayify, - checkOrSetAlreadyCaught, - getEventDescription, - parseSemver, - uuid4, -} from './misc'; -export { dynamicRequire, isNodeEnv, loadModule } from './node'; -export { normalize, normalizeToSize, normalizeUrlToBase } from './normalize'; -export { - addNonEnumerableProperty, - convertToPlainObject, - dropUndefinedKeys, - extractExceptionKeysForMessage, - fill, - getOriginalFunction, - markFunctionWrapped, - objectify, - urlEncode, -} from './object'; -export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path'; -export { makePromiseBuffer } from './promisebuffer'; -export type { PromiseBuffer } from './promisebuffer'; - -// TODO: Remove requestdata export once equivalent integration is used everywhere -export { - DEFAULT_USER_INCLUDES, - addNormalizedRequestDataToEvent, - addRequestDataToEvent, - // eslint-disable-next-line deprecation/deprecation - extractPathForTransaction, - extractRequestData, - winterCGHeadersToDict, - winterCGRequestToRequestData, - httpRequestToRequestData, - extractQueryParamsFromUrl, - headersToDict, -} from './requestdata'; -export type { - AddRequestDataToEventOptions, - // eslint-disable-next-line deprecation/deprecation - TransactionNamingScheme, -} from './requestdata'; - -export { severityLevelFromString, validSeverityLevels } from './severity'; -export { - UNKNOWN_FUNCTION, - createStackParser, - getFramesFromEvent, - getFunctionName, - stackParserFromStackParserOptions, - stripSentryFramesAndReverse, -} from './stacktrace'; -export { filenameIsInApp, node, nodeStackLineParser } from './node-stack-trace'; -export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate } from './string'; -export { - isNativeFunction, - supportsDOMError, - supportsDOMException, - supportsErrorEvent, - supportsFetch, - supportsNativeFetch, - supportsReferrerPolicy, - supportsReportingObserver, -} from './supports'; -export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise'; -export { - _browserPerformanceTimeOriginMode, - browserPerformanceTimeOrigin, - dateTimestampInSeconds, - timestampInSeconds, -} from './time'; -export { - TRACEPARENT_REGEXP, - extractTraceparentData, - generateSentryTraceHeader, - propagationContextFromHeaders, -} from './tracing'; -export { getSDKSource, isBrowserBundle } from './env'; -export type { SdkSource } from './env'; -export { - addItemToEnvelope, - createAttachmentEnvelopeItem, - createEnvelope, - createEventEnvelopeHeaders, - createSpanEnvelopeItem, - envelopeContainsItemType, - envelopeItemTypeToDataCategory, - forEachEnvelopeItem, - getSdkMetadataForEnvelopeHeader, - parseEnvelope, - serializeEnvelope, -} from './envelope'; -export { createClientReportEnvelope } from './clientreport'; -export { - DEFAULT_RETRY_AFTER, - disabledUntil, - isRateLimited, - parseRetryAfterHeader, - updateRateLimits, -} from './ratelimit'; -export type { RateLimits } from './ratelimit'; -export { - BAGGAGE_HEADER_NAME, - MAX_BAGGAGE_STRING_LENGTH, - SENTRY_BAGGAGE_KEY_PREFIX, - SENTRY_BAGGAGE_KEY_PREFIX_REGEX, - baggageHeaderToDynamicSamplingContext, - dynamicSamplingContextToSentryBaggageHeader, - parseBaggageHeader, -} from './baggage'; - -export { getNumberOfUrlSegments, getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from './url'; -export { makeFifoCache } from './cache'; -export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames } from './eventbuilder'; -export { callFrameToStackFrame, watchdogTimer } from './anr'; -export { LRUMap } from './lru'; -export { generatePropagationContext } from './propagationContext'; -export { vercelWaitUntil } from './vercelWaitUntil'; -export { SDK_VERSION } from './version'; -export { getDebugImagesForResources, getFilenameToDebugIdMap } from './debug-ids'; -export { escapeStringForRegex } from './vendor/escapeStringForRegex'; -export { supportsHistory } from './vendor/supportsHistory'; - -export { _asyncNullishCoalesce } from './buildPolyfills/_asyncNullishCoalesce'; -export { _asyncOptionalChain } from './buildPolyfills/_asyncOptionalChain'; -export { _asyncOptionalChainDelete } from './buildPolyfills/_asyncOptionalChainDelete'; -export { _nullishCoalesce } from './buildPolyfills/_nullishCoalesce'; -export { _optionalChain } from './buildPolyfills/_optionalChain'; -export { _optionalChainDelete } from './buildPolyfills/_optionalChainDelete'; diff --git a/packages/core/src/utils/applyScopeDataToEvent.ts b/packages/core/src/utils/applyScopeDataToEvent.ts index ccf3f62ae153..f3b1ac0d0be7 100644 --- a/packages/core/src/utils/applyScopeDataToEvent.ts +++ b/packages/core/src/utils/applyScopeDataToEvent.ts @@ -1,7 +1,6 @@ import type { Breadcrumb, Event, ScopeData, Span } from '@sentry/types'; +import { arrayify, dropUndefinedKeys } from '@sentry/utils'; import { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext'; -import { dropUndefinedKeys } from '../utils-hoist'; -import { merge } from './merge'; import { getRootSpan, spanToJSON, spanToTraceContext } from './spanUtils'; /** @@ -47,8 +46,7 @@ export function mergeScopeData(data: ScopeData, mergeData: ScopeData): void { mergeAndOverwriteScopeData(data, 'tags', tags); mergeAndOverwriteScopeData(data, 'user', user); mergeAndOverwriteScopeData(data, 'contexts', contexts); - - data.sdkProcessingMetadata = merge(data.sdkProcessingMetadata, sdkProcessingMetadata, 2); + mergeAndOverwriteScopeData(data, 'sdkProcessingMetadata', sdkProcessingMetadata); if (level) { data.level = level; @@ -89,7 +87,15 @@ export function mergeAndOverwriteScopeData< Prop extends 'extra' | 'tags' | 'user' | 'contexts' | 'sdkProcessingMetadata', Data extends ScopeData, >(data: Data, prop: Prop, mergeVal: Data[Prop]): void { - data[prop] = merge(data[prop], mergeVal, 1); + if (mergeVal && Object.keys(mergeVal).length) { + // Clone object + data[prop] = { ...data[prop] }; + for (const key in mergeVal) { + if (Object.prototype.hasOwnProperty.call(mergeVal, key)) { + data[prop][key] = mergeVal[key]; + } + } + } } /** Exported only for tests */ @@ -178,11 +184,7 @@ function applySpanToEvent(event: Event, span: Span): void { */ function applyFingerprintToEvent(event: Event, fingerprint: ScopeData['fingerprint'] | undefined): void { // Make sure it's an array first and we actually have something in place - event.fingerprint = event.fingerprint - ? Array.isArray(event.fingerprint) - ? event.fingerprint - : [event.fingerprint] - : []; + event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : []; // If we have something on the scope, then merge it with event if (fingerprint) { diff --git a/packages/core/src/utils/handleCallbackErrors.ts b/packages/core/src/utils/handleCallbackErrors.ts index 7e281b6b7d1c..b3bec065581d 100644 --- a/packages/core/src/utils/handleCallbackErrors.ts +++ b/packages/core/src/utils/handleCallbackErrors.ts @@ -1,4 +1,4 @@ -import { isThenable } from '../utils-hoist/is'; +import { isThenable } from '@sentry/utils'; /** * Wrap a callback function with error handling. diff --git a/packages/core/src/utils/merge.ts b/packages/core/src/utils/merge.ts deleted file mode 100644 index d80520b45cf6..000000000000 --- a/packages/core/src/utils/merge.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Shallow merge two objects. - * Does not mutate the passed in objects. - * Undefined/empty values in the merge object will overwrite existing values. - * - * By default, this merges 2 levels deep. - */ -export function merge(initialObj: T, mergeObj: T, levels = 2): T { - // If the merge value is not an object, or we have no merge levels left, - // we just set the value to the merge value - if (!mergeObj || typeof mergeObj !== 'object' || levels <= 0) { - return mergeObj; - } - - // If the merge object is an empty object, and the initial object is not undefined, we return the initial object - if (initialObj && mergeObj && Object.keys(mergeObj).length === 0) { - return initialObj; - } - - // Clone object - const output = { ...initialObj }; - - // Merge values into output, resursively - for (const key in mergeObj) { - if (Object.prototype.hasOwnProperty.call(mergeObj, key)) { - output[key] = merge(output[key], mergeObj[key], levels - 1); - } - } - - return output; -} diff --git a/packages/core/src/utils/parseSampleRate.ts b/packages/core/src/utils/parseSampleRate.ts index 3e297025b52e..fdf12371eff6 100644 --- a/packages/core/src/utils/parseSampleRate.ts +++ b/packages/core/src/utils/parseSampleRate.ts @@ -1,5 +1,5 @@ +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; -import { logger } from '../utils-hoist/logger'; /** * Parse a sample rate from a given value. diff --git a/packages/core/src/utils/prepareEvent.ts b/packages/core/src/utils/prepareEvent.ts index bf23a0e3ee79..9ee0a0f1b1b6 100644 --- a/packages/core/src/utils/prepareEvent.ts +++ b/packages/core/src/utils/prepareEvent.ts @@ -8,16 +8,19 @@ import type { ScopeContext, StackParser, } from '@sentry/types'; +import { + addExceptionMechanism, + dateTimestampInSeconds, + getFilenameToDebugIdMap, + normalize, + truncate, + uuid4, +} from '@sentry/utils'; import { DEFAULT_ENVIRONMENT } from '../constants'; import { getGlobalScope } from '../currentScopes'; import { notifyEventProcessors } from '../eventProcessors'; import { Scope } from '../scope'; -import { getFilenameToDebugIdMap } from '../utils-hoist/debug-ids'; -import { addExceptionMechanism, uuid4 } from '../utils-hoist/misc'; -import { normalize } from '../utils-hoist/normalize'; -import { truncate } from '../utils-hoist/string'; -import { dateTimestampInSeconds } from '../utils-hoist/time'; import { applyScopeDataToEvent, mergeScopeData } from './applyScopeDataToEvent'; /** diff --git a/packages/core/src/utils/sdkMetadata.ts b/packages/core/src/utils/sdkMetadata.ts index 7d2905abf84f..9ad46bc5b375 100644 --- a/packages/core/src/utils/sdkMetadata.ts +++ b/packages/core/src/utils/sdkMetadata.ts @@ -1,5 +1,5 @@ import type { Options } from '@sentry/types'; -import { SDK_VERSION } from '../utils-hoist/version'; +import { SDK_VERSION } from '@sentry/utils'; /** * A builder for the SDK metadata in the options for the SDK initialization. diff --git a/packages/core/src/utils/spanOnScope.ts b/packages/core/src/utils/spanOnScope.ts index e7607f0fa090..f6403b57b1b4 100644 --- a/packages/core/src/utils/spanOnScope.ts +++ b/packages/core/src/utils/spanOnScope.ts @@ -1,5 +1,5 @@ import type { Scope, Span } from '@sentry/types'; -import { addNonEnumerableProperty } from '../utils-hoist/object'; +import { addNonEnumerableProperty } from '@sentry/utils'; const SCOPE_SPAN_FIELD = '_sentrySpan'; diff --git a/packages/core/src/utils/spanUtils.ts b/packages/core/src/utils/spanUtils.ts index 5f0c443919a3..266a0035b382 100644 --- a/packages/core/src/utils/spanUtils.ts +++ b/packages/core/src/utils/spanUtils.ts @@ -9,6 +9,12 @@ import type { SpanTimeInput, TraceContext, } from '@sentry/types'; +import { + addNonEnumerableProperty, + dropUndefinedKeys, + generateSentryTraceHeader, + timestampInSeconds, +} from '@sentry/utils'; import { getAsyncContextStrategy } from '../asyncContext'; import { getMainCarrier } from '../carrier'; import { getCurrentScope } from '../currentScopes'; @@ -17,9 +23,6 @@ import type { MetricType } from '../metrics/types'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../semanticAttributes'; import type { SentrySpan } from '../tracing/sentrySpan'; import { SPAN_STATUS_OK, SPAN_STATUS_UNSET } from '../tracing/spanstatus'; -import { addNonEnumerableProperty, dropUndefinedKeys } from '../utils-hoist/object'; -import { timestampInSeconds } from '../utils-hoist/time'; -import { generateSentryTraceHeader } from '../utils-hoist/tracing'; import { _getSpanForScope } from './spanOnScope'; // These are aligned with OpenTelemetry trace flags diff --git a/packages/core/src/utils/traceData.ts b/packages/core/src/utils/traceData.ts index 04727510e07c..c56c8f71ba1d 100644 --- a/packages/core/src/utils/traceData.ts +++ b/packages/core/src/utils/traceData.ts @@ -1,12 +1,15 @@ import type { SerializedTraceData } from '@sentry/types'; +import { + TRACEPARENT_REGEXP, + dynamicSamplingContextToSentryBaggageHeader, + generateSentryTraceHeader, + logger, +} from '@sentry/utils'; import { getAsyncContextStrategy } from '../asyncContext'; import { getMainCarrier } from '../carrier'; import { getClient, getCurrentScope } from '../currentScopes'; import { isEnabled } from '../exports'; import { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan } from '../tracing'; -import { dynamicSamplingContextToSentryBaggageHeader } from '../utils-hoist/baggage'; -import { logger } from '../utils-hoist/logger'; -import { TRACEPARENT_REGEXP, generateSentryTraceHeader } from '../utils-hoist/tracing'; import { getActiveSpan, getRootSpan, spanToTraceHeader } from './spanUtils'; /** diff --git a/packages/core/test/lib/api.test.ts b/packages/core/test/lib/api.test.ts index 2c581937cc42..d2e500776228 100644 --- a/packages/core/test/lib/api.test.ts +++ b/packages/core/test/lib/api.test.ts @@ -1,7 +1,7 @@ import type { DsnComponents, SdkInfo } from '@sentry/types'; +import { makeDsn } from '@sentry/utils'; import { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from '../../src/api'; -import { makeDsn } from '../../src/utils-hoist/dsn'; const ingestDsn = 'https://abc@xxxx.ingest.sentry.io:1234/subpath/123'; const dsnPublic = 'https://abc@sentry.io:1234/subpath/123'; diff --git a/packages/core/test/lib/attachments.test.ts b/packages/core/test/lib/attachments.test.ts index 4ddd0acac6c0..4f43f86a6451 100644 --- a/packages/core/test/lib/attachments.test.ts +++ b/packages/core/test/lib/attachments.test.ts @@ -1,5 +1,6 @@ +import { parseEnvelope } from '@sentry/utils'; + import { createTransport } from '../../src/transports/base'; -import { parseEnvelope } from '../../src/utils-hoist/envelope'; import { TestClient, getDefaultTestClientOptions } from '../mocks/client'; describe('Attachments', () => { diff --git a/packages/core/test/lib/base.test.ts b/packages/core/test/lib/base.test.ts index 296a496d2d40..c89065ed218a 100644 --- a/packages/core/test/lib/base.test.ts +++ b/packages/core/test/lib/base.test.ts @@ -1,10 +1,5 @@ -import { SentryError, SyncPromise, dsnToString } from '@sentry/core'; import type { Client, Envelope, ErrorEvent, Event, TransactionEvent } from '@sentry/types'; - -import * as loggerModule from '../../src/utils-hoist/logger'; -import * as miscModule from '../../src/utils-hoist/misc'; -import * as stringModule from '../../src/utils-hoist/string'; -import * as timeModule from '../../src/utils-hoist/time'; +import { SentryError, SyncPromise, dsnToString, logger } from '@sentry/utils'; import { Scope, @@ -29,10 +24,38 @@ declare var global: any; const clientEventFromException = jest.spyOn(TestClient.prototype, 'eventFromException'); const clientProcess = jest.spyOn(TestClient.prototype as any, '_process'); -jest.spyOn(miscModule, 'uuid4').mockImplementation(() => '42'); -jest.spyOn(loggerModule, 'consoleSandbox').mockImplementation(cb => cb()); -jest.spyOn(stringModule, 'truncate').mockImplementation(str => str); -jest.spyOn(timeModule, 'dateTimestampInSeconds').mockImplementation(() => 2020); +jest.mock('@sentry/utils', () => { + const original = jest.requireActual('@sentry/utils'); + return { + ...original, + + uuid4(): string { + return '42'; + }, + GLOBAL_OBJ: { + console: { + log(): void { + // no-empty + }, + warn(): void { + // no-empty + }, + error(): void { + // no-empty + }, + }, + }, + consoleSandbox(cb: () => any): any { + return cb(); + }, + truncate(str: string): string { + return str; + }, + dateTimestampInSeconds(): number { + return 2020; + }, + }; +}); describe('BaseClient', () => { beforeEach(() => { @@ -1090,7 +1113,7 @@ describe('BaseClient', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSend }); const client = new TestClient(options); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerWarnSpy = jest.spyOn(loggerModule.logger, 'log'); + const loggerWarnSpy = jest.spyOn(logger, 'log'); client.captureEvent({ message: 'hello' }); @@ -1109,7 +1132,7 @@ describe('BaseClient', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSendTransaction }); const client = new TestClient(options); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerWarnSpy = jest.spyOn(loggerModule.logger, 'log'); + const loggerWarnSpy = jest.spyOn(logger, 'log'); client.captureEvent({ transaction: '/dogs/are/great', type: 'transaction' }); @@ -1161,7 +1184,7 @@ describe('BaseClient', () => { // @ts-expect-error we need to test regular-js behavior const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSend }); const client = new TestClient(options); - const loggerWarnSpy = jest.spyOn(loggerModule.logger, 'warn'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); client.captureEvent({ message: 'hello' }); @@ -1182,7 +1205,7 @@ describe('BaseClient', () => { // @ts-expect-error we need to test regular-js behavior const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN, beforeSendTransaction }); const client = new TestClient(options); - const loggerWarnSpy = jest.spyOn(loggerModule.logger, 'warn'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); client.captureEvent({ transaction: '/dogs/are/great', type: 'transaction' }); @@ -1441,7 +1464,7 @@ describe('BaseClient', () => { const client = new TestClient(getDefaultTestClientOptions({ dsn: PUBLIC_DSN })); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerLogSpy = jest.spyOn(loggerModule.logger, 'log'); + const loggerLogSpy = jest.spyOn(logger, 'log'); const scope = new Scope(); scope.addEventProcessor(() => null); @@ -1459,7 +1482,7 @@ describe('BaseClient', () => { const client = new TestClient(getDefaultTestClientOptions({ dsn: PUBLIC_DSN })); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerLogSpy = jest.spyOn(loggerModule.logger, 'log'); + const loggerLogSpy = jest.spyOn(logger, 'log'); const scope = new Scope(); scope.addEventProcessor(() => null); @@ -1563,7 +1586,7 @@ describe('BaseClient', () => { const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN }); const client = new TestClient(options); const captureExceptionSpy = jest.spyOn(client, 'captureException'); - const loggerWarnSpy = jest.spyOn(loggerModule.logger, 'warn'); + const loggerWarnSpy = jest.spyOn(logger, 'warn'); const scope = new Scope(); const exception = new Error('sorry'); scope.addEventProcessor(() => { diff --git a/packages/core/test/lib/carrier.test.ts b/packages/core/test/lib/carrier.test.ts index 19ebc8117ca4..6e846d496ea5 100644 --- a/packages/core/test/lib/carrier.test.ts +++ b/packages/core/test/lib/carrier.test.ts @@ -1,5 +1,5 @@ +import { SDK_VERSION } from '@sentry/utils'; import { getSentryCarrier } from '../../src/carrier'; -import { SDK_VERSION } from '../../src/utils-hoist/version'; describe('getSentryCarrier', () => { describe('base case (one SDK)', () => { diff --git a/packages/core/test/lib/clear-global-scope.ts b/packages/core/test/lib/clear-global-scope.ts index 8fa0340a22bb..0ebe6884429a 100644 --- a/packages/core/test/lib/clear-global-scope.ts +++ b/packages/core/test/lib/clear-global-scope.ts @@ -1,5 +1,5 @@ +import { GLOBAL_OBJ } from '@sentry/utils'; import { getSentryCarrier } from '../../src/carrier'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; export function clearGlobalScope() { const carrier = getSentryCarrier(GLOBAL_OBJ); diff --git a/packages/core/test/lib/hint.test.ts b/packages/core/test/lib/hint.test.ts index d455a5bd5e44..c5a31a944663 100644 --- a/packages/core/test/lib/hint.test.ts +++ b/packages/core/test/lib/hint.test.ts @@ -1,4 +1,6 @@ -import { GLOBAL_OBJ, captureEvent, getCurrentScope } from '../../src'; +import { GLOBAL_OBJ } from '@sentry/utils'; + +import { captureEvent, getCurrentScope } from '../../src'; import { initAndBind } from '../../src/sdk'; import { TestClient, getDefaultTestClientOptions } from '../mocks/client'; import { AddAttachmentTestIntegration } from '../mocks/integration'; diff --git a/packages/core/test/lib/integration.test.ts b/packages/core/test/lib/integration.test.ts index 128c46984d90..3a1a1ae19768 100644 --- a/packages/core/test/lib/integration.test.ts +++ b/packages/core/test/lib/integration.test.ts @@ -1,9 +1,9 @@ import type { Integration, Options } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { getCurrentScope } from '../../src/currentScopes'; import { addIntegration, getIntegrationsToSetup, installedIntegrations, setupIntegration } from '../../src/integration'; import { setCurrentClient } from '../../src/sdk'; -import { logger } from '../../src/utils-hoist/logger'; import { TestClient, getDefaultTestClientOptions } from '../mocks/client'; function getTestClient(): TestClient { diff --git a/packages/core/test/lib/integrations/captureconsole.test.ts b/packages/core/test/lib/integrations/captureconsole.test.ts index 18fe7e637499..ce913642b123 100644 --- a/packages/core/test/lib/integrations/captureconsole.test.ts +++ b/packages/core/test/lib/integrations/captureconsole.test.ts @@ -1,14 +1,17 @@ /* eslint-disable @typescript-eslint/unbound-method */ import type { Client, ConsoleLevel, Event } from '@sentry/types'; +import { + CONSOLE_LEVELS, + GLOBAL_OBJ, + addConsoleInstrumentationHandler, + originalConsoleMethods, + resetInstrumentationHandlers, +} from '@sentry/utils'; import * as CurrentScopes from '../../../src/currentScopes'; import * as SentryCore from '../../../src/exports'; import { captureConsoleIntegration } from '../../../src/integrations/captureconsole'; -import { addConsoleInstrumentationHandler } from '../../../src/utils-hoist/instrument/console'; -import { resetInstrumentationHandlers } from '../../../src/utils-hoist/instrument/handlers'; -import { CONSOLE_LEVELS, originalConsoleMethods } from '../../../src/utils-hoist/logger'; -import { GLOBAL_OBJ } from '../../../src/utils-hoist/worldwide'; const mockConsole: { [key in ConsoleLevel]: jest.Mock } = { debug: jest.fn(), diff --git a/packages/core/test/lib/integrations/debug.test.ts b/packages/core/test/lib/integrations/debug.test.ts index 87e1027af6e0..c391d3057f0e 100644 --- a/packages/core/test/lib/integrations/debug.test.ts +++ b/packages/core/test/lib/integrations/debug.test.ts @@ -3,7 +3,6 @@ import type { Client, Event, EventHint } from '@sentry/types'; import { debugIntegration } from '../../../src/integrations/debug'; function testEventLogged( - // eslint-disable-next-line deprecation/deprecation integration: ReturnType, testEvent?: Event, testEventHint?: EventHint, @@ -43,7 +42,6 @@ describe('Debug integration setup should register an event processor that', () = }); it('logs an event', () => { - // eslint-disable-next-line deprecation/deprecation const debug = debugIntegration(); const testEvent = { event_id: 'some event' }; @@ -54,7 +52,6 @@ describe('Debug integration setup should register an event processor that', () = }); it('logs an event hint if available', () => { - // eslint-disable-next-line deprecation/deprecation const debug = debugIntegration(); const testEvent = { event_id: 'some event' }; @@ -68,7 +65,6 @@ describe('Debug integration setup should register an event processor that', () = }); it('logs events in stringified format when `stringify` option was set', () => { - // eslint-disable-next-line deprecation/deprecation const debug = debugIntegration({ stringify: true }); const testEvent = { event_id: 'some event' }; @@ -79,7 +75,6 @@ describe('Debug integration setup should register an event processor that', () = }); it('logs event hints in stringified format when `stringify` option was set', () => { - // eslint-disable-next-line deprecation/deprecation const debug = debugIntegration({ stringify: true }); const testEvent = { event_id: 'some event' }; diff --git a/packages/core/test/lib/integrations/functiontostring.test.ts b/packages/core/test/lib/integrations/functiontostring.test.ts index 37c12e2c2b92..87a85744c7ce 100644 --- a/packages/core/test/lib/integrations/functiontostring.test.ts +++ b/packages/core/test/lib/integrations/functiontostring.test.ts @@ -1,4 +1,5 @@ -import { fill, getClient, getCurrentScope, setCurrentClient } from '../../../src'; +import { fill } from '@sentry/utils'; +import { getClient, getCurrentScope, setCurrentClient } from '../../../src'; import { functionToStringIntegration } from '../../../src/integrations/functiontostring'; import { TestClient, getDefaultTestClientOptions } from '../../mocks/client'; diff --git a/packages/core/test/lib/integrations/metadata.test.ts b/packages/core/test/lib/integrations/metadata.test.ts index 2e4a70bfa848..2fb06bd6081d 100644 --- a/packages/core/test/lib/integrations/metadata.test.ts +++ b/packages/core/test/lib/integrations/metadata.test.ts @@ -1,15 +1,7 @@ import type { Event } from '@sentry/types'; +import { GLOBAL_OBJ, createStackParser, nodeStackLineParser, parseEnvelope } from '@sentry/utils'; -import { - GLOBAL_OBJ, - captureException, - createStackParser, - createTransport, - moduleMetadataIntegration, - nodeStackLineParser, - parseEnvelope, - setCurrentClient, -} from '../../../src'; +import { captureException, createTransport, moduleMetadataIntegration, setCurrentClient } from '../../../src'; import { TestClient, getDefaultTestClientOptions } from '../../mocks/client'; const stackParser = createStackParser(nodeStackLineParser()); diff --git a/packages/core/test/lib/integrations/requestdata.test.ts b/packages/core/test/lib/integrations/requestdata.test.ts index 4603d5b290cf..648d47e4faf5 100644 --- a/packages/core/test/lib/integrations/requestdata.test.ts +++ b/packages/core/test/lib/integrations/requestdata.test.ts @@ -1,13 +1,12 @@ import type { IncomingMessage } from 'http'; import type { Event, EventProcessor } from '@sentry/types'; +import * as sentryUtils from '@sentry/utils'; import type { RequestDataIntegrationOptions } from '../../../src'; import { requestDataIntegration, setCurrentClient } from '../../../src'; import { TestClient, getDefaultTestClientOptions } from '../../mocks/client'; -import * as requestDataModule from '../../../src/utils-hoist/requestdata'; - -const addRequestDataToEventSpy = jest.spyOn(requestDataModule, 'addRequestDataToEvent'); +const addRequestDataToEventSpy = jest.spyOn(sentryUtils, 'addRequestDataToEvent'); const headers = { ears: 'furry', nose: 'wet', tongue: 'spotted', cookie: 'favorite=zukes' }; const method = 'wagging'; diff --git a/packages/core/test/lib/integrations/sessiontiming.test.ts b/packages/core/test/lib/integrations/sessiontiming.test.ts index 1fd2fa53e361..6213d7cae9c1 100644 --- a/packages/core/test/lib/integrations/sessiontiming.test.ts +++ b/packages/core/test/lib/integrations/sessiontiming.test.ts @@ -1,7 +1,6 @@ import type { Event } from '@sentry/types'; import { sessionTimingIntegration } from '../../../src/integrations/sessiontiming'; -// eslint-disable-next-line deprecation/deprecation const sessionTiming = sessionTimingIntegration(); describe('SessionTiming', () => { diff --git a/packages/core/test/lib/integrations/third-party-errors-filter.test.ts b/packages/core/test/lib/integrations/third-party-errors-filter.test.ts index 91cfe7d4900b..b11b93498b02 100644 --- a/packages/core/test/lib/integrations/third-party-errors-filter.test.ts +++ b/packages/core/test/lib/integrations/third-party-errors-filter.test.ts @@ -1,9 +1,7 @@ import type { Client, Event } from '@sentry/types'; +import { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/utils'; import { thirdPartyErrorFilterIntegration } from '../../../src/integrations/third-party-errors-filter'; import { addMetadataToStackFrames } from '../../../src/metadata'; -import { nodeStackLineParser } from '../../../src/utils-hoist/node-stack-trace'; -import { createStackParser } from '../../../src/utils-hoist/stacktrace'; -import { GLOBAL_OBJ } from '../../../src/utils-hoist/worldwide'; function clone(data: T): T { return JSON.parse(JSON.stringify(data)); diff --git a/packages/core/test/lib/metadata.test.ts b/packages/core/test/lib/metadata.test.ts index c3b31b68423f..378bb51e6562 100644 --- a/packages/core/test/lib/metadata.test.ts +++ b/packages/core/test/lib/metadata.test.ts @@ -1,9 +1,7 @@ import type { Event } from '@sentry/types'; +import { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/utils'; import { addMetadataToStackFrames, getMetadataForUrl, stripMetadataFromStackFrames } from '../../src/metadata'; -import { nodeStackLineParser } from '../../src/utils-hoist/node-stack-trace'; -import { createStackParser } from '../../src/utils-hoist/stacktrace'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; const parser = createStackParser(nodeStackLineParser()); diff --git a/packages/core/test/lib/prepareEvent.test.ts b/packages/core/test/lib/prepareEvent.test.ts index a905d948475a..0698aa15e447 100644 --- a/packages/core/test/lib/prepareEvent.test.ts +++ b/packages/core/test/lib/prepareEvent.test.ts @@ -8,7 +8,8 @@ import type { EventProcessor, ScopeContext, } from '@sentry/types'; -import { GLOBAL_OBJ, createStackParser, getGlobalScope, getIsolationScope } from '../../src'; +import { GLOBAL_OBJ, createStackParser } from '@sentry/utils'; +import { getGlobalScope, getIsolationScope } from '../../src'; import { Scope } from '../../src/scope'; import { diff --git a/packages/core/test/lib/scope.test.ts b/packages/core/test/lib/scope.test.ts index c6a081948453..33c89a2e9eb5 100644 --- a/packages/core/test/lib/scope.test.ts +++ b/packages/core/test/lib/scope.test.ts @@ -204,27 +204,10 @@ describe('Scope', () => { expect(scope['_user']).toEqual({}); }); - describe('setProcessingMetadata', () => { - test('it works with no initial data', () => { - const scope = new Scope(); - scope.setSDKProcessingMetadata({ dogs: 'are great!' }); - expect(scope['_sdkProcessingMetadata'].dogs).toEqual('are great!'); - }); - - test('it overwrites data', () => { - const scope = new Scope(); - scope.setSDKProcessingMetadata({ dogs: 'are great!' }); - scope.setSDKProcessingMetadata({ dogs: 'are really great!' }); - scope.setSDKProcessingMetadata({ cats: 'are also great!' }); - scope.setSDKProcessingMetadata({ obj: { nested1: 'value1', nested: 'value1' } }); - scope.setSDKProcessingMetadata({ obj: { nested2: 'value2', nested: 'value2' } }); - - expect(scope['_sdkProcessingMetadata']).toEqual({ - dogs: 'are really great!', - cats: 'are also great!', - obj: { nested2: 'value2', nested: 'value2', nested1: 'value1' }, - }); - }); + test('setProcessingMetadata', () => { + const scope = new Scope(); + scope.setSDKProcessingMetadata({ dogs: 'are great!' }); + expect(scope['_sdkProcessingMetadata'].dogs).toEqual('are great!'); }); test('set and get propagation context', () => { diff --git a/packages/core/test/lib/session.test.ts b/packages/core/test/lib/session.test.ts index 55524866dcc2..41eb0c234d13 100644 --- a/packages/core/test/lib/session.test.ts +++ b/packages/core/test/lib/session.test.ts @@ -1,7 +1,7 @@ import type { SessionContext } from '@sentry/types'; +import { timestampInSeconds } from '@sentry/utils'; import { closeSession, makeSession, updateSession } from '../../src/session'; -import { timestampInSeconds } from '../../src/utils-hoist/time'; describe('Session', () => { it('initializes with the proper defaults', () => { diff --git a/packages/core/test/lib/tracing/errors.test.ts b/packages/core/test/lib/tracing/errors.test.ts index 68a3463b7878..3e3f85ef73b7 100644 --- a/packages/core/test/lib/tracing/errors.test.ts +++ b/packages/core/test/lib/tracing/errors.test.ts @@ -2,23 +2,28 @@ import type { HandlerDataError, HandlerDataUnhandledRejection } from '@sentry/ty import { setCurrentClient, spanToJSON, startInactiveSpan, startSpan } from '../../../src'; import { _resetErrorsInstrumented, registerSpanErrorInstrumentation } from '../../../src/tracing/errors'; -import * as globalErrorModule from '../../../src/utils-hoist/instrument/globalError'; -import * as globalUnhandledRejectionModule from '../../../src/utils-hoist/instrument/globalUnhandledRejection'; import { TestClient, getDefaultTestClientOptions } from '../../mocks/client'; +const mockAddGlobalErrorInstrumentationHandler = jest.fn(); +const mockAddGlobalUnhandledRejectionInstrumentationHandler = jest.fn(); let mockErrorCallback: (data: HandlerDataError) => void = () => {}; let mockUnhandledRejectionCallback: (data: HandlerDataUnhandledRejection) => void = () => {}; -const mockAddGlobalErrorInstrumentationHandler = jest - .spyOn(globalErrorModule, 'addGlobalErrorInstrumentationHandler') - .mockImplementation(callback => { - mockErrorCallback = callback; - }); -const mockAddGlobalUnhandledRejectionInstrumentationHandler = jest - .spyOn(globalUnhandledRejectionModule, 'addGlobalUnhandledRejectionInstrumentationHandler') - .mockImplementation(callback => { - mockUnhandledRejectionCallback = callback; - }); +jest.mock('@sentry/utils', () => { + const actual = jest.requireActual('@sentry/utils'); + return { + ...actual, + addGlobalErrorInstrumentationHandler: (callback: () => void) => { + mockErrorCallback = callback; + + return mockAddGlobalErrorInstrumentationHandler(callback); + }, + addGlobalUnhandledRejectionInstrumentationHandler: (callback: () => void) => { + mockUnhandledRejectionCallback = callback; + return mockAddGlobalUnhandledRejectionInstrumentationHandler(callback); + }, + }; +}); describe('registerErrorHandlers()', () => { beforeEach(() => { diff --git a/packages/core/test/lib/tracing/sentrySpan.test.ts b/packages/core/test/lib/tracing/sentrySpan.test.ts index 447e42328a2e..8e43123e3f3c 100644 --- a/packages/core/test/lib/tracing/sentrySpan.test.ts +++ b/packages/core/test/lib/tracing/sentrySpan.test.ts @@ -1,4 +1,5 @@ -import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient, timestampInSeconds } from '../../../src'; +import { timestampInSeconds } from '@sentry/utils'; +import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setCurrentClient } from '../../../src'; import { SentrySpan } from '../../../src/tracing/sentrySpan'; import { SPAN_STATUS_ERROR } from '../../../src/tracing/spanstatus'; import { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, spanToJSON } from '../../../src/utils/spanUtils'; diff --git a/packages/core/test/lib/transports/base.test.ts b/packages/core/test/lib/transports/base.test.ts index 438dbb93c836..a8198ce38b3d 100644 --- a/packages/core/test/lib/transports/base.test.ts +++ b/packages/core/test/lib/transports/base.test.ts @@ -1,9 +1,8 @@ import type { AttachmentItem, EventEnvelope, EventItem, TransportMakeRequestResponse } from '@sentry/types'; +import type { PromiseBuffer } from '@sentry/utils'; +import { createEnvelope, resolvedSyncPromise, serializeEnvelope } from '@sentry/utils'; import { createTransport } from '../../../src/transports/base'; -import { createEnvelope, serializeEnvelope } from '../../../src/utils-hoist/envelope'; -import type { PromiseBuffer } from '../../../src/utils-hoist/promisebuffer'; -import { resolvedSyncPromise } from '../../../src/utils-hoist/syncpromise'; const ERROR_ENVELOPE = createEnvelope({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }, [ [{ type: 'event' }, { event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2' }] as EventItem, diff --git a/packages/core/test/lib/transports/multiplexed.test.ts b/packages/core/test/lib/transports/multiplexed.test.ts index 97d69e5a6113..4ddde08437f2 100644 --- a/packages/core/test/lib/transports/multiplexed.test.ts +++ b/packages/core/test/lib/transports/multiplexed.test.ts @@ -7,16 +7,9 @@ import type { TransactionEvent, Transport, } from '@sentry/types'; +import { createClientReportEnvelope, createEnvelope, dsnFromString, parseEnvelope } from '@sentry/utils'; -import { - createClientReportEnvelope, - createEnvelope, - createTransport, - dsnFromString, - getEnvelopeEndpointWithUrlEncodedAuth, - makeMultiplexedTransport, - parseEnvelope, -} from '../../../src'; +import { createTransport, getEnvelopeEndpointWithUrlEncodedAuth, makeMultiplexedTransport } from '../../../src'; import { eventFromEnvelope } from '../../../src/transports/multiplexed'; const DSN1 = 'https://1234@5678.ingest.sentry.io/4321'; diff --git a/packages/core/test/lib/transports/offline.test.ts b/packages/core/test/lib/transports/offline.test.ts index c266a00d1378..738597197178 100644 --- a/packages/core/test/lib/transports/offline.test.ts +++ b/packages/core/test/lib/transports/offline.test.ts @@ -8,16 +8,16 @@ import type { ReplayEvent, TransportMakeRequestResponse, } from '@sentry/types'; - import { createClientReportEnvelope, createEnvelope, createEventEnvelopeHeaders, - createTransport, dsnFromString, getSdkMetadataForEnvelopeHeader, parseEnvelope, -} from '../../../src'; +} from '@sentry/utils'; + +import { createTransport } from '../../../src'; import type { CreateOfflineStore, OfflineTransportOptions } from '../../../src/transports/offline'; import { START_DELAY, makeOfflineTransport } from '../../../src/transports/offline'; diff --git a/packages/core/test/lib/utils/applyScopeDataToEvent.test.ts b/packages/core/test/lib/utils/applyScopeDataToEvent.test.ts index 7fb7befcd2a7..e6370931f4cf 100644 --- a/packages/core/test/lib/utils/applyScopeDataToEvent.test.ts +++ b/packages/core/test/lib/utils/applyScopeDataToEvent.test.ts @@ -134,15 +134,7 @@ describe('mergeScopeData', () => { contexts: { os: { name: 'os1' }, culture: { display_name: 'name1' } }, attachments: [attachment1], propagationContext: { spanId: '1', traceId: '1' }, - sdkProcessingMetadata: { - aa: 'aa', - bb: 'aa', - obj: { key: 'value' }, - normalizedRequest: { - url: 'oldUrl', - method: 'oldMethod', - }, - }, + sdkProcessingMetadata: { aa: 'aa', bb: 'aa' }, fingerprint: ['aa', 'bb'], }; const data2: ScopeData = { @@ -154,15 +146,7 @@ describe('mergeScopeData', () => { contexts: { os: { name: 'os2' } }, attachments: [attachment2, attachment3], propagationContext: { spanId: '2', traceId: '2' }, - sdkProcessingMetadata: { - bb: 'bb', - cc: 'bb', - obj: { key2: 'value2' }, - normalizedRequest: { - url: 'newUrl', - headers: {}, - }, - }, + sdkProcessingMetadata: { bb: 'bb', cc: 'bb' }, fingerprint: ['cc'], }; mergeScopeData(data1, data2); @@ -175,17 +159,7 @@ describe('mergeScopeData', () => { contexts: { os: { name: 'os2' }, culture: { display_name: 'name1' } }, attachments: [attachment1, attachment2, attachment3], propagationContext: { spanId: '2', traceId: '2' }, - sdkProcessingMetadata: { - aa: 'aa', - bb: 'bb', - cc: 'bb', - obj: { key: 'value', key2: 'value2' }, - normalizedRequest: { - url: 'newUrl', - method: 'oldMethod', - headers: {}, - }, - }, + sdkProcessingMetadata: { aa: 'aa', bb: 'bb', cc: 'bb' }, fingerprint: ['aa', 'bb', 'cc'], }); }); diff --git a/packages/core/test/lib/utils/merge.test.ts b/packages/core/test/lib/utils/merge.test.ts deleted file mode 100644 index b0a215231bfb..000000000000 --- a/packages/core/test/lib/utils/merge.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { merge } from '../../../src/utils/merge'; - -describe('merge', () => { - it('works with empty objects', () => { - const oldData = {}; - const newData = {}; - - const actual = merge(oldData, newData); - - expect(actual).toEqual({}); - expect(actual).toBe(oldData); - expect(actual).not.toBe(newData); - }); - - it('works with empty merge object', () => { - const oldData = { aa: 'aha' }; - const newData = {}; - - const actual = merge(oldData, newData); - - expect(actual).toEqual({ aa: 'aha' }); - expect(actual).toBe(oldData); - expect(actual).not.toBe(newData); - }); - - it('works with arbitrary data', () => { - const oldData = { - old1: 'old1', - old2: 'old2', - obj: { key: 'value1', key1: 'value1', deep: { key: 'value' } }, - } as any; - const newData = { - new1: 'new1', - old2: 'new2', - obj: { key2: 'value2', key: 'value2', deep: { key2: 'value2' } }, - } as any; - - const actual = merge(oldData, newData); - - expect(actual).toEqual({ - old1: 'old1', - old2: 'new2', - new1: 'new1', - obj: { - key2: 'value2', - key: 'value2', - key1: 'value1', - deep: { key2: 'value2' }, - }, - }); - expect(actual).not.toBe(oldData); - expect(actual).not.toBe(newData); - }); - - it.each([ - [undefined, { a: 'aa' }, { a: 'aa' }], - [{ a: 'aa' }, undefined, undefined], - [{ a: 'aa' }, null, null], - [{ a: 'aa' }, { a: undefined }, { a: undefined }], - [{ a: 'aa' }, { a: null }, { a: null }], - [{ a: 'aa' }, { a: '' }, { a: '' }], - [ - { a0: { a1: { a2: { a3: { a4: 'a4a' }, a3a: 'a3a' }, a2a: 'a2a' }, a1a: 'a1a' }, a0a: 'a0a' }, - { a0: { a1: { a2: { a3: { a4: 'a4b' }, a3b: 'a3b' }, a2b: 'a2b' }, a1b: 'a1b' }, a0b: 'a0b' }, - { - a0: { a1: { a2: { a3: { a4: 'a4b' }, a3b: 'a3b' }, a2b: 'a2b' }, a1b: 'a1b', a1a: 'a1a' }, - a0b: 'a0b', - a0a: 'a0a', - }, - ], - ])('works with %p and %p', (oldData, newData, expected) => { - const actual = merge(oldData, newData as any); - expect(actual).toEqual(expected); - }); -}); diff --git a/packages/core/test/lib/utils/spanUtils.test.ts b/packages/core/test/lib/utils/spanUtils.test.ts index 4f763a5edba6..779e75006c86 100644 --- a/packages/core/test/lib/utils/spanUtils.test.ts +++ b/packages/core/test/lib/utils/spanUtils.test.ts @@ -1,4 +1,5 @@ import type { Span, SpanAttributes, SpanStatus, SpanTimeInput } from '@sentry/types'; +import { TRACEPARENT_REGEXP, timestampInSeconds } from '@sentry/utils'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, @@ -6,12 +7,10 @@ import { SPAN_STATUS_OK, SPAN_STATUS_UNSET, SentrySpan, - TRACEPARENT_REGEXP, setCurrentClient, spanToTraceHeader, startInactiveSpan, startSpan, - timestampInSeconds, } from '../../../src'; import type { OpenTelemetrySdkTraceBaseSpan } from '../../../src/utils/spanUtils'; import { getRootSpan, spanIsSampled, spanTimeInputToSeconds, spanToJSON } from '../../../src/utils/spanUtils'; diff --git a/packages/core/test/mocks/client.ts b/packages/core/test/mocks/client.ts index 712134388aef..fd12e9ee5223 100644 --- a/packages/core/test/mocks/client.ts +++ b/packages/core/test/mocks/client.ts @@ -8,11 +8,11 @@ import type { Session, SeverityLevel, } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; import { BaseClient } from '../../src/baseclient'; import { initAndBind } from '../../src/sdk'; import { createTransport } from '../../src/transports/base'; -import { resolvedSyncPromise } from '../../src/utils-hoist/syncpromise'; export function getDefaultTestClientOptions(options: Partial = {}): TestClientOptions { return { diff --git a/packages/core/test/mocks/transport.ts b/packages/core/test/mocks/transport.ts index af6863237562..cfb15f0abb7a 100644 --- a/packages/core/test/mocks/transport.ts +++ b/packages/core/test/mocks/transport.ts @@ -1,7 +1,7 @@ import type { Transport } from '@sentry/types'; +import { SyncPromise } from '@sentry/utils'; import { createTransport } from '../../src/transports/base'; -import { SyncPromise } from '../../src/utils-hoist/syncpromise'; async function sleep(delay: number): Promise { return new SyncPromise(resolve => setTimeout(resolve, delay)); diff --git a/packages/deno/package.json b/packages/deno/package.json index 3e3b0ca81226..3463469a5869 100644 --- a/packages/deno/package.json +++ b/packages/deno/package.json @@ -25,7 +25,8 @@ ], "dependencies": { "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "devDependencies": { "@rollup/plugin-typescript": "^11.1.5", diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 5538f92519a9..3531074793f3 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -18,7 +18,7 @@ export type { Thread, User, } from '@sentry/types'; -export type { AddRequestDataToEventOptions } from '@sentry/core'; +export type { AddRequestDataToEventOptions } from '@sentry/utils'; export type { DenoOptions } from './types'; @@ -71,12 +71,10 @@ export { functionToStringIntegration, requestDataIntegration, captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, zodErrorsIntegration, SEMANTIC_ATTRIBUTE_SENTRY_OP, diff --git a/packages/deno/src/integrations/breadcrumbs.ts b/packages/deno/src/integrations/breadcrumbs.ts index 77c471793ed3..6b945ebc37f5 100644 --- a/packages/deno/src/integrations/breadcrumbs.ts +++ b/packages/deno/src/integrations/breadcrumbs.ts @@ -1,12 +1,4 @@ import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; -import { - addConsoleInstrumentationHandler, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - getEventDescription, - safeJoin, - severityLevelFromString, -} from '@sentry/core'; import type { Client, Event as SentryEvent, @@ -16,6 +8,14 @@ import type { HandlerDataFetch, IntegrationFn, } from '@sentry/types'; +import { + addConsoleInstrumentationHandler, + addFetchInstrumentationHandler, + getBreadcrumbLogLevelFromHttpStatusCode, + getEventDescription, + safeJoin, + severityLevelFromString, +} from '@sentry/utils'; interface BreadcrumbsOptions { console: boolean; diff --git a/packages/deno/src/integrations/contextlines.ts b/packages/deno/src/integrations/contextlines.ts index 44dc400c9aa0..3f3db47fb70a 100644 --- a/packages/deno/src/integrations/contextlines.ts +++ b/packages/deno/src/integrations/contextlines.ts @@ -1,6 +1,6 @@ import { defineIntegration } from '@sentry/core'; -import { LRUMap, addContextToFrame } from '@sentry/core'; import type { Event, IntegrationFn, StackFrame } from '@sentry/types'; +import { LRUMap, addContextToFrame } from '@sentry/utils'; const INTEGRATION_NAME = 'ContextLines'; const FILE_CONTENT_CACHE = new LRUMap(100); diff --git a/packages/deno/src/integrations/globalhandlers.ts b/packages/deno/src/integrations/globalhandlers.ts index bf985f1096c8..8d9a2c1ac051 100644 --- a/packages/deno/src/integrations/globalhandlers.ts +++ b/packages/deno/src/integrations/globalhandlers.ts @@ -3,8 +3,8 @@ import { defineIntegration } from '@sentry/core'; import { captureEvent } from '@sentry/core'; import { getClient } from '@sentry/core'; import { flush } from '@sentry/core'; -import { eventFromUnknownInput, isPrimitive } from '@sentry/core'; import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/types'; +import { eventFromUnknownInput, isPrimitive } from '@sentry/utils'; type GlobalHandlersIntegrationsOptionKeys = 'error' | 'unhandledrejection'; diff --git a/packages/deno/src/integrations/normalizepaths.ts b/packages/deno/src/integrations/normalizepaths.ts index ad8b18694652..07e0f872338b 100644 --- a/packages/deno/src/integrations/normalizepaths.ts +++ b/packages/deno/src/integrations/normalizepaths.ts @@ -1,6 +1,6 @@ import { defineIntegration } from '@sentry/core'; -import { createStackParser, dirname, nodeStackLineParser } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; +import { createStackParser, dirname, nodeStackLineParser } from '@sentry/utils'; const INTEGRATION_NAME = 'NormalizePaths'; diff --git a/packages/deno/src/sdk.ts b/packages/deno/src/sdk.ts index 57c6817c51ee..4072196c721f 100644 --- a/packages/deno/src/sdk.ts +++ b/packages/deno/src/sdk.ts @@ -6,8 +6,8 @@ import { linkedErrorsIntegration, } from '@sentry/core'; import { getIntegrationsToSetup, initAndBind } from '@sentry/core'; -import { createStackParser, nodeStackLineParser, stackParserFromStackParserOptions } from '@sentry/core'; import type { Client, Integration, Options, StackParser } from '@sentry/types'; +import { createStackParser, nodeStackLineParser, stackParserFromStackParserOptions } from '@sentry/utils'; import { DenoClient } from './client'; import { breadcrumbsIntegration } from './integrations/breadcrumbs'; diff --git a/packages/deno/src/transports/index.ts b/packages/deno/src/transports/index.ts index d55c58f6054f..1b2b3c661af9 100644 --- a/packages/deno/src/transports/index.ts +++ b/packages/deno/src/transports/index.ts @@ -1,6 +1,6 @@ import { createTransport, suppressTracing } from '@sentry/core'; -import { consoleSandbox, logger, rejectedSyncPromise } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types'; +import { consoleSandbox, logger, rejectedSyncPromise } from '@sentry/utils'; export interface DenoTransportOptions extends BaseTransportOptions { /** Custom headers for the transport. Used by the XHRTransport and FetchTransport */ diff --git a/packages/deno/test/build.ts b/packages/deno/test/build.ts index 86bb371afc08..b593fed2f4dd 100644 --- a/packages/deno/test/build.ts +++ b/packages/deno/test/build.ts @@ -1,4 +1,4 @@ // We use this as the entry point to bundle Sentry dependencies that are used by the tests. export * as sentryTypes from '@sentry/types'; -export * as sentryUtils from '@sentry/core'; +export * as sentryUtils from '@sentry/utils'; export * as sentryCore from '@sentry/core'; diff --git a/packages/ember/addon/index.ts b/packages/ember/addon/index.ts index 2080581b6138..341d74763634 100644 --- a/packages/ember/addon/index.ts +++ b/packages/ember/addon/index.ts @@ -6,7 +6,7 @@ import { startSpan } from '@sentry/browser'; import type { BrowserOptions } from '@sentry/browser'; import * as Sentry from '@sentry/browser'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, applySdkMetadata } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; +import { GLOBAL_OBJ } from '@sentry/utils'; import Ember from 'ember'; import type { Client, TransactionSource } from '@sentry/types'; diff --git a/packages/ember/addon/instance-initializers/sentry-performance.ts b/packages/ember/addon/instance-initializers/sentry-performance.ts index 614426cb47c9..f8d03a025217 100644 --- a/packages/ember/addon/instance-initializers/sentry-performance.ts +++ b/packages/ember/addon/instance-initializers/sentry-performance.ts @@ -18,9 +18,9 @@ import { getClient, startInactiveSpan, } from '@sentry/browser'; -import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/core'; import type { ExtendedBackburner } from '@sentry/ember/runloop'; import type { Span } from '@sentry/types'; +import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/utils'; import type { EmberRouterMain, EmberSentryConfig, GlobalConfig, OwnConfig } from '../types'; function getSentryConfig(): EmberSentryConfig { diff --git a/packages/ember/package.json b/packages/ember/package.json index 0c2cd23efda3..c5f8d3dc1cbd 100644 --- a/packages/ember/package.json +++ b/packages/ember/package.json @@ -35,6 +35,7 @@ "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "ember-auto-import": "^2.7.2", "ember-cli-babel": "^8.2.0", "ember-cli-htmlbars": "^6.1.1", diff --git a/packages/feedback/package.json b/packages/feedback/package.json index bb35267bd1b0..649be9cb34f4 100644 --- a/packages/feedback/package.json +++ b/packages/feedback/package.json @@ -40,7 +40,8 @@ }, "dependencies": { "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "devDependencies": { "preact": "^10.19.4" diff --git a/packages/feedback/rollup.bundle.config.mjs b/packages/feedback/rollup.bundle.config.mjs index a5efc6140c06..18343602562c 100644 --- a/packages/feedback/rollup.bundle.config.mjs +++ b/packages/feedback/rollup.bundle.config.mjs @@ -15,7 +15,6 @@ export default [ jsxPragma: 'h', jsxFragmentPragma: 'Fragment', jsxRuntime: 'classic', - production: true, }, }), ), @@ -31,7 +30,6 @@ export default [ jsxPragma: 'h', jsxFragmentPragma: 'Fragment', jsxRuntime: 'classic', - production: true, }, }), ), diff --git a/packages/feedback/rollup.npm.config.mjs b/packages/feedback/rollup.npm.config.mjs index c91c37ec84f8..2b4f6af2739c 100644 --- a/packages/feedback/rollup.npm.config.mjs +++ b/packages/feedback/rollup.npm.config.mjs @@ -20,7 +20,6 @@ export default makeNPMConfigVariants( jsxPragma: 'h', jsxFragmentPragma: 'Fragment', jsxRuntime: 'classic', - production: true, }, }), ); diff --git a/packages/feedback/src/constants/index.ts b/packages/feedback/src/constants/index.ts index 198b6e199bb5..2a6bc0d171aa 100644 --- a/packages/feedback/src/constants/index.ts +++ b/packages/feedback/src/constants/index.ts @@ -1,4 +1,4 @@ -import { GLOBAL_OBJ } from '@sentry/core'; +import { GLOBAL_OBJ } from '@sentry/utils'; // exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser` // prevents the browser package from being bundled in the CDN bundle, and avoids a diff --git a/packages/feedback/src/core/TestClient.ts b/packages/feedback/src/core/TestClient.ts index c938acd182f5..39ed51fcff67 100644 --- a/packages/feedback/src/core/TestClient.ts +++ b/packages/feedback/src/core/TestClient.ts @@ -1,6 +1,6 @@ import { BaseClient, createTransport, initAndBind } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { BrowserClientReplayOptions, ClientOptions, Event, SeverityLevel } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; export interface TestClientOptions extends ClientOptions, BrowserClientReplayOptions {} diff --git a/packages/feedback/src/core/integration.ts b/packages/feedback/src/core/integration.ts index 1ff5f9778cb3..c72b28b1d04b 100644 --- a/packages/feedback/src/core/integration.ts +++ b/packages/feedback/src/core/integration.ts @@ -1,5 +1,4 @@ import { getClient } from '@sentry/core'; -import { isBrowser, logger } from '@sentry/core'; import type { FeedbackInternalOptions, FeedbackModalIntegration, @@ -7,6 +6,7 @@ import type { Integration, IntegrationFn, } from '@sentry/types'; +import { isBrowser, logger } from '@sentry/utils'; import { ADD_SCREENSHOT_LABEL, CANCEL_BUTTON_LABEL, diff --git a/packages/feedback/src/core/sendFeedback.ts b/packages/feedback/src/core/sendFeedback.ts index 3503c55a2ef2..c0b8ccaa2704 100644 --- a/packages/feedback/src/core/sendFeedback.ts +++ b/packages/feedback/src/core/sendFeedback.ts @@ -1,8 +1,8 @@ import { captureFeedback } from '@sentry/core'; import { getClient } from '@sentry/core'; import { getCurrentScope } from '@sentry/core'; -import { getLocationHref } from '@sentry/core'; import type { Event, EventHint, SendFeedback, SendFeedbackParams, TransportMakeRequestResponse } from '@sentry/types'; +import { getLocationHref } from '@sentry/utils'; import { FEEDBACK_API_SOURCE } from '../constants'; /** diff --git a/packages/feedback/src/modal/components/Form.tsx b/packages/feedback/src/modal/components/Form.tsx index 4267e10f81d4..d6cc94ec7f60 100644 --- a/packages/feedback/src/modal/components/Form.tsx +++ b/packages/feedback/src/modal/components/Form.tsx @@ -1,10 +1,10 @@ -import { logger } from '@sentry/core'; import type { FeedbackFormData, FeedbackInternalOptions, FeedbackScreenshotIntegration, SendFeedback, } from '@sentry/types'; +import { logger } from '@sentry/utils'; // biome-ignore lint/nursery/noUnusedImports: reason import { h } from 'preact'; // eslint-disable-line @typescript-eslint/no-unused-vars import type { JSX, VNode } from 'preact'; diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index cbacfcc8ecd0..eac87b2cd709 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -48,6 +48,7 @@ "@sentry/core": "8.39.0", "@sentry/react": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@sentry/webpack-plugin": "2.22.6" }, "peerDependencies": { diff --git a/packages/google-cloud-serverless/package.json b/packages/google-cloud-serverless/package.json index c901ac8983cf..e7fa0810af63 100644 --- a/packages/google-cloud-serverless/package.json +++ b/packages/google-cloud-serverless/package.json @@ -51,6 +51,7 @@ "@sentry/core": "8.39.0", "@sentry/node": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@types/express": "^4.17.14" }, "devDependencies": { diff --git a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts index 8b4daf27c9b0..3ea4858d829c 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/cloud_events.ts @@ -1,6 +1,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors } from '@sentry/core'; -import { logger } from '@sentry/core'; import { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { domainify, markEventUnhandled, proxyFunction } from '../utils'; diff --git a/packages/google-cloud-serverless/src/gcpfunction/events.ts b/packages/google-cloud-serverless/src/gcpfunction/events.ts index 319329ccf28f..bdecbeff9868 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/events.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/events.ts @@ -1,6 +1,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors } from '@sentry/core'; -import { logger } from '@sentry/core'; import { captureException, flush, getCurrentScope, startSpanManual } from '@sentry/node'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { domainify, markEventUnhandled, proxyFunction } from '../utils'; diff --git a/packages/google-cloud-serverless/src/gcpfunction/http.ts b/packages/google-cloud-serverless/src/gcpfunction/http.ts index 46b61c0ee8f1..4a27bae2ecf9 100644 --- a/packages/google-cloud-serverless/src/gcpfunction/http.ts +++ b/packages/google-cloud-serverless/src/gcpfunction/http.ts @@ -2,13 +2,11 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, handleCallbackErrors, - httpRequestToRequestData, - isString, - logger, setHttpStatus, - stripUrlQueryAndFragment, } from '@sentry/core'; import { captureException, continueTrace, flush, getCurrentScope, startSpanManual } from '@sentry/node'; +import { isString, logger, stripUrlQueryAndFragment } from '@sentry/utils'; + import { DEBUG_BUILD } from '../debug-build'; import { domainify, markEventUnhandled, proxyFunction } from '../utils'; import type { HttpFunction, WrapperOptions } from './general'; @@ -46,9 +44,6 @@ function _wrapHttpFunction(fn: HttpFunction, options: Partial): const baggage = req.headers?.baggage; return continueTrace({ sentryTrace, baggage }, () => { - const normalizedRequest = httpRequestToRequestData(req); - getCurrentScope().setSDKProcessingMetadata({ normalizedRequest }); - return startSpanManual( { name: `${reqMethod} ${reqUrl}`, @@ -59,6 +54,10 @@ function _wrapHttpFunction(fn: HttpFunction, options: Partial): }, }, span => { + getCurrentScope().setSDKProcessingMetadata({ + request: req, + }); + // eslint-disable-next-line @typescript-eslint/unbound-method const _end = res.end; // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/google-cloud-serverless/src/index.ts b/packages/google-cloud-serverless/src/index.ts index 5be557af86c5..53cf4c026868 100644 --- a/packages/google-cloud-serverless/src/index.ts +++ b/packages/google-cloud-serverless/src/index.ts @@ -101,9 +101,7 @@ export { mysql2Integration, redisIntegration, tediousIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, postgresIntegration, prismaIntegration, @@ -126,12 +124,10 @@ export { export { captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, } from '@sentry/core'; diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts index 11c2f1cf236a..3b55fe99eeb8 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-grpc.ts @@ -1,8 +1,8 @@ import type { EventEmitter } from 'events'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, getClient } from '@sentry/core'; -import { fill } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; import type { Client, IntegrationFn } from '@sentry/types'; +import { fill } from '@sentry/utils'; interface GrpcFunction extends CallableFunction { (...args: unknown[]): EventEmitter; diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts index fa26b03f486f..9ffad40fd7b6 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts @@ -1,8 +1,8 @@ import type * as common from '@google-cloud/common'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SentryNonRecordingSpan, defineIntegration, getClient } from '@sentry/core'; -import { fill } from '@sentry/core'; import { startInactiveSpan } from '@sentry/node'; import type { Client, IntegrationFn } from '@sentry/types'; +import { fill } from '@sentry/utils'; type RequestOptions = common.DecorateRequestOptions; type ResponseCallback = common.BodyResponseCallback; diff --git a/packages/google-cloud-serverless/src/utils.ts b/packages/google-cloud-serverless/src/utils.ts index 8e33f55b51cd..ba3082b7e262 100644 --- a/packages/google-cloud-serverless/src/utils.ts +++ b/packages/google-cloud-serverless/src/utils.ts @@ -1,6 +1,6 @@ import { withIsolationScope } from '@sentry/core'; -import { addExceptionMechanism } from '@sentry/core'; import type { Scope } from '@sentry/types'; +import { addExceptionMechanism } from '@sentry/utils'; /** * @param fn function to run diff --git a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts index d19850ce6679..8b0168e61949 100644 --- a/packages/google-cloud-serverless/test/gcpfunction/http.test.ts +++ b/packages/google-cloud-serverless/test/gcpfunction/http.test.ts @@ -176,12 +176,11 @@ describe('GCPFunction', () => { expect(defaultIntegrations).toContain('RequestData'); expect(mockScope.setSDKProcessingMetadata).toHaveBeenCalledWith({ - normalizedRequest: { + request: { method: 'POST', - url: 'http://hostname/path?q=query', + url: '/path?q=query', headers: { host: 'hostname', 'content-type': 'application/json' }, - query_string: 'q=query', - data: { foo: 'bar' }, + body: { foo: 'bar' }, }, }); }); diff --git a/packages/integration-shims/package.json b/packages/integration-shims/package.json index 9c0a81fec7b5..982c8f1e18f9 100644 --- a/packages/integration-shims/package.json +++ b/packages/integration-shims/package.json @@ -56,7 +56,8 @@ }, "dependencies": { "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "engines": { "node": ">=14.18" diff --git a/packages/integration-shims/src/BrowserTracing.ts b/packages/integration-shims/src/BrowserTracing.ts index 49f1c097a9e5..cd6ed88060a6 100644 --- a/packages/integration-shims/src/BrowserTracing.ts +++ b/packages/integration-shims/src/BrowserTracing.ts @@ -1,5 +1,5 @@ import { defineIntegration } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; /** * This is a shim for the BrowserTracing integration. diff --git a/packages/integration-shims/src/Feedback.ts b/packages/integration-shims/src/Feedback.ts index caec59969918..ef4010bb0494 100644 --- a/packages/integration-shims/src/Feedback.ts +++ b/packages/integration-shims/src/Feedback.ts @@ -1,5 +1,5 @@ -import { consoleSandbox } from '@sentry/core'; import type { Integration } from '@sentry/types'; +import { consoleSandbox } from '@sentry/utils'; import { FAKE_FUNCTION } from './common'; const FEEDBACK_INTEGRATION_METHODS = ['attachTo', 'createForm', 'createWidget', 'remove'] as const; diff --git a/packages/integration-shims/src/Replay.ts b/packages/integration-shims/src/Replay.ts index 30c06a9ab461..1f44fdf6bb3a 100644 --- a/packages/integration-shims/src/Replay.ts +++ b/packages/integration-shims/src/Replay.ts @@ -1,5 +1,5 @@ -import { consoleSandbox } from '@sentry/core'; import type { Integration } from '@sentry/types'; +import { consoleSandbox } from '@sentry/utils'; import { FAKE_FUNCTION } from './common'; const REPLAY_INTEGRATION_METHODS = ['start', 'stop', 'flush'] as const; diff --git a/packages/integration-shims/src/metrics.ts b/packages/integration-shims/src/metrics.ts index a30a4a3c678e..3f2414742501 100644 --- a/packages/integration-shims/src/metrics.ts +++ b/packages/integration-shims/src/metrics.ts @@ -1,5 +1,5 @@ -import { consoleSandbox } from '@sentry/core'; import type { Metrics } from '@sentry/types'; +import { consoleSandbox } from '@sentry/utils'; function warn(): void { consoleSandbox(() => { diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json index 50c400041ca3..2c49d68c3190 100644 --- a/packages/nestjs/package.json +++ b/packages/nestjs/package.json @@ -46,7 +46,8 @@ "dependencies": { "@sentry/core": "8.39.0", "@sentry/node": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "devDependencies": { "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0", diff --git a/packages/nestjs/src/decorators.ts b/packages/nestjs/src/decorators.ts index 0a23ab488a2f..60e1049b3fd2 100644 --- a/packages/nestjs/src/decorators.ts +++ b/packages/nestjs/src/decorators.ts @@ -83,7 +83,5 @@ export function SentryExceptionCaptured() { /** * A decorator to wrap user-defined exception filters and add Sentry error reporting. - * - * @deprecated This decorator was renamed and will be removed in a future major version. Use `SentryExceptionCaptured` instead. */ export const WithSentry = SentryExceptionCaptured; diff --git a/packages/nestjs/src/index.ts b/packages/nestjs/src/index.ts index c26edc3b4941..d99f491c1f6c 100644 --- a/packages/nestjs/src/index.ts +++ b/packages/nestjs/src/index.ts @@ -1,21 +1,10 @@ -import { nestIntegration as nestIntegrationAlias } from '@sentry/node'; - export * from '@sentry/node'; -/** - * Integration capturing tracing data for NestJS. - */ -// eslint-disable-next-line deprecation/deprecation -export const nestIntegration = nestIntegrationAlias; - -// TODO(v9): Export custom `getDefaultIntegrations` from this SDK that automatically registers the `nestIntegration`. - export { init } from './sdk'; export { SentryTraced, SentryCron, - // eslint-disable-next-line deprecation/deprecation WithSentry, SentryExceptionCaptured, } from './decorators'; diff --git a/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index 08646402b187..0d7ccdb2c4dc 100644 --- a/packages/nestjs/src/setup.ts +++ b/packages/nestjs/src/setup.ts @@ -18,8 +18,8 @@ import { getIsolationScope, spanToJSON, } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import type { Observable } from 'rxjs'; import { isExpectedError } from './helpers'; @@ -29,10 +29,6 @@ import { isExpectedError } from './helpers'; /** * Interceptor to add Sentry tracing capabilities to Nest.js applications. - * - * @deprecated `SentryTracingInterceptor` is deprecated. - * If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`. - * If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards. */ class SentryTracingInterceptor implements NestInterceptor { // used to exclude this class from being auto-instrumented @@ -63,9 +59,7 @@ class SentryTracingInterceptor implements NestInterceptor { return next.handle(); } } -// eslint-disable-next-line deprecation/deprecation Injectable()(SentryTracingInterceptor); -// eslint-disable-next-line deprecation/deprecation export { SentryTracingInterceptor }; /** @@ -114,8 +108,6 @@ export { SentryGlobalFilter }; /** * Global filter to handle exceptions in NestJS + GraphQL applications and report them to Sentry. - * - * @deprecated `SentryGlobalGraphQLFilter` is deprecated. Use the `SentryGlobalFilter` instead. The `SentryGlobalFilter` is a drop-in replacement. */ class SentryGlobalGraphQLFilter { private static readonly _logger = new Logger('ExceptionsHandler'); @@ -135,33 +127,24 @@ class SentryGlobalGraphQLFilter { throw exception; } if (exception instanceof Error) { - // eslint-disable-next-line deprecation/deprecation SentryGlobalGraphQLFilter._logger.error(exception.message, exception.stack); } captureException(exception); throw exception; } } -// eslint-disable-next-line deprecation/deprecation Catch()(SentryGlobalGraphQLFilter); -// eslint-disable-next-line deprecation/deprecation export { SentryGlobalGraphQLFilter }; /** * Global filter to handle exceptions and report them to Sentry. * * This filter is a generic filter that can handle both HTTP and GraphQL exceptions. - * - * @deprecated `SentryGlobalGenericFilter` is deprecated. Use the `SentryGlobalFilter` instead. The `SentryGlobalFilter` is a drop-in replacement. */ export const SentryGlobalGenericFilter = SentryGlobalFilter; /** * Service to set up Sentry performance tracing for Nest.js applications. - * - * @deprecated `SentryService` is deprecated. - * If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`. - * If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService` afterwards. */ class SentryService implements OnModuleInit { public readonly __SENTRY_INTERNAL__: boolean; @@ -185,9 +168,7 @@ class SentryService implements OnModuleInit { } } } -// eslint-disable-next-line deprecation/deprecation Injectable()(SentryService); -// eslint-disable-next-line deprecation/deprecation export { SentryService }; /** @@ -201,15 +182,12 @@ class SentryModule { return { module: SentryModule, providers: [ - // eslint-disable-next-line deprecation/deprecation SentryService, { provide: APP_INTERCEPTOR, - // eslint-disable-next-line deprecation/deprecation useClass: SentryTracingInterceptor, }, ], - // eslint-disable-next-line deprecation/deprecation exports: [SentryService], }; } @@ -217,15 +195,12 @@ class SentryModule { Global()(SentryModule); Module({ providers: [ - // eslint-disable-next-line deprecation/deprecation SentryService, { provide: APP_INTERCEPTOR, - // eslint-disable-next-line deprecation/deprecation useClass: SentryTracingInterceptor, }, ], - // eslint-disable-next-line deprecation/deprecation exports: [SentryService], })(SentryModule); export { SentryModule }; diff --git a/packages/nestjs/test/sdk.test.ts b/packages/nestjs/test/sdk.test.ts index 0f61ee249261..77d19fa2c797 100644 --- a/packages/nestjs/test/sdk.test.ts +++ b/packages/nestjs/test/sdk.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { SDK_VERSION } from '@sentry/core'; import * as SentryNode from '@sentry/node'; +import { SDK_VERSION } from '@sentry/utils'; import { init as nestInit } from '../src/sdk'; diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 1cd4407fe9cc..da09c237501f 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -86,6 +86,7 @@ "@sentry/opentelemetry": "8.39.0", "@sentry/react": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@sentry/vercel-edge": "8.39.0", "@sentry/webpack-plugin": "2.22.6", "chalk": "3.0.0", diff --git a/packages/nextjs/src/client/index.ts b/packages/nextjs/src/client/index.ts index 10e1d94566af..a1e6aba11308 100644 --- a/packages/nextjs/src/client/index.ts +++ b/packages/nextjs/src/client/index.ts @@ -1,8 +1,8 @@ import { addEventProcessor, applySdkMetadata } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; import type { BrowserOptions } from '@sentry/react'; import { getDefaultIntegrations as getReactDefaultIntegrations, init as reactInit } from '@sentry/react'; import type { Client, EventProcessor, Integration } from '@sentry/types'; +import { GLOBAL_OBJ } from '@sentry/utils'; import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolicationEventProcessor'; import { getVercelEnv } from '../common/getVercelEnv'; diff --git a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts index 11faf8d2a68b..4c92e0999f57 100644 --- a/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/appRouterRoutingInstrumentation.ts @@ -3,9 +3,9 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; -import { GLOBAL_OBJ, browserPerformanceTimeOrigin } from '@sentry/core'; import { WINDOW, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } from '@sentry/react'; import type { Client, Span } from '@sentry/types'; +import { GLOBAL_OBJ, browserPerformanceTimeOrigin } from '@sentry/utils'; export const INCOMPLETE_APP_ROUTER_INSTRUMENTATION_TRANSACTION_NAME = 'incomplete-app-router-transaction'; diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index 6a2df057017c..2380b743cced 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -4,9 +4,9 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, } from '@sentry/core'; -import { browserPerformanceTimeOrigin, logger, parseBaggageHeader, stripUrlQueryAndFragment } from '@sentry/core'; import { WINDOW, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } from '@sentry/react'; import type { Client, TransactionSource } from '@sentry/types'; +import { browserPerformanceTimeOrigin, logger, parseBaggageHeader, stripUrlQueryAndFragment } from '@sentry/utils'; import type { NEXT_DATA } from 'next/dist/shared/lib/utils'; import RouterImport from 'next/router'; diff --git a/packages/nextjs/src/client/tunnelRoute.ts b/packages/nextjs/src/client/tunnelRoute.ts index 7d9a79d1fca6..59ce4cfe82b7 100644 --- a/packages/nextjs/src/client/tunnelRoute.ts +++ b/packages/nextjs/src/client/tunnelRoute.ts @@ -1,5 +1,5 @@ -import { GLOBAL_OBJ, dsnFromString, logger } from '@sentry/core'; import type { BrowserOptions } from '@sentry/react'; +import { GLOBAL_OBJ, dsnFromString, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../common/debug-build'; diff --git a/packages/nextjs/src/common/captureRequestError.ts b/packages/nextjs/src/common/captureRequestError.ts index 2dc4d8ff6325..1556076619a0 100644 --- a/packages/nextjs/src/common/captureRequestError.ts +++ b/packages/nextjs/src/common/captureRequestError.ts @@ -1,6 +1,4 @@ import { captureException, withScope } from '@sentry/core'; -import { headersToDict } from '@sentry/core'; -import type { RequestEventData } from '@sentry/types'; type RequestInfo = { path: string; @@ -20,10 +18,10 @@ type ErrorContext = { export function captureRequestError(error: unknown, request: RequestInfo, errorContext: ErrorContext): void { withScope(scope => { scope.setSDKProcessingMetadata({ - normalizedRequest: { - headers: headersToDict(request.headers), + request: { + headers: request.headers, method: request.method, - } satisfies RequestEventData, + }, }); scope.setContext('nextjs', { diff --git a/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts b/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts index 1a117517a964..143bf6fef6ef 100644 --- a/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts +++ b/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts @@ -1,6 +1,6 @@ import { suppressTracing } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; import type { Event, EventHint } from '@sentry/types'; +import { GLOBAL_OBJ } from '@sentry/utils'; import type { StackFrame } from 'stacktrace-parser'; import * as stackTraceParser from 'stacktrace-parser'; diff --git a/packages/nextjs/src/common/nextNavigationErrorUtils.ts b/packages/nextjs/src/common/nextNavigationErrorUtils.ts index b7f4d1de9b4c..d4a67791525f 100644 --- a/packages/nextjs/src/common/nextNavigationErrorUtils.ts +++ b/packages/nextjs/src/common/nextNavigationErrorUtils.ts @@ -1,16 +1,11 @@ -import { isError } from '@sentry/core'; +import { isError } from '@sentry/utils'; /** * Determines whether input is a Next.js not-found error. * https://beta.nextjs.org/docs/api-reference/notfound#notfound */ export function isNotFoundNavigationError(subject: unknown): boolean { - return ( - isError(subject) && - ['NEXT_NOT_FOUND', 'NEXT_HTTP_ERROR_FALLBACK;404'].includes( - (subject as Error & { digest?: unknown }).digest as string, - ) - ); + return isError(subject) && (subject as Error & { digest?: unknown }).digest === 'NEXT_NOT_FOUND'; } /** diff --git a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts index a96b3131a56f..3450aad8ef5e 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/_error.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/_error.ts @@ -1,5 +1,5 @@ -import { captureException, httpRequestToRequestData, withScope } from '@sentry/core'; -import { vercelWaitUntil } from '@sentry/core'; +import { captureException, withScope } from '@sentry/core'; +import { vercelWaitUntil } from '@sentry/utils'; import type { NextPageContext } from 'next'; import { flushSafelyWithTimeout } from '../utils/responseEnd'; @@ -38,8 +38,7 @@ export async function captureUnderscoreErrorException(contextOrProps: ContextOrP withScope(scope => { if (req) { - const normalizedRequest = httpRequestToRequestData(req); - scope.setSDKProcessingMetadata({ normalizedRequest }); + scope.setSDKProcessingMetadata({ request: req }); } // If third-party libraries (or users themselves) throw something falsy, we want to capture it as a message (which diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts index 347ac9ffd7e9..30fce67e482e 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts @@ -3,14 +3,13 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, captureException, continueTrace, - httpRequestToRequestData, setHttpStatus, startSpanManual, withIsolationScope, } from '@sentry/core'; -import { isString, logger, objectify } from '@sentry/core'; +import { isString, logger, objectify } from '@sentry/utils'; -import { vercelWaitUntil } from '@sentry/core'; +import { vercelWaitUntil } from '@sentry/utils'; import type { NextApiRequest } from 'next'; import type { AugmentedNextApiResponse, NextApiHandler } from '../types'; import { flushSafelyWithTimeout } from '../utils/responseEnd'; @@ -66,9 +65,8 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz }, () => { const reqMethod = `${(req.method || 'GET').toUpperCase()} `; - const normalizedRequest = httpRequestToRequestData(req); - isolationScope.setSDKProcessingMetadata({ normalizedRequest }); + isolationScope.setSDKProcessingMetadata({ request: req }); isolationScope.setTransactionName(`${reqMethod}${parameterizedRoute}`); return startSpanManual( diff --git a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts index 3d481235be25..8b6a45faa63b 100644 --- a/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts +++ b/packages/nextjs/src/common/pages-router-instrumentation/wrapPageComponentWithSentry.ts @@ -1,5 +1,5 @@ import { captureException, getCurrentScope, withIsolationScope } from '@sentry/core'; -import { extractTraceparentData } from '@sentry/core'; +import { extractTraceparentData } from '@sentry/utils'; interface FunctionComponent { (...args: unknown[]): unknown; diff --git a/packages/nextjs/src/common/utils/responseEnd.ts b/packages/nextjs/src/common/utils/responseEnd.ts index 1ccfd1f913d5..b59dbf0ce170 100644 --- a/packages/nextjs/src/common/utils/responseEnd.ts +++ b/packages/nextjs/src/common/utils/responseEnd.ts @@ -1,7 +1,7 @@ import type { ServerResponse } from 'http'; import { flush, setHttpStatus } from '@sentry/core'; -import { fill, logger } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { fill, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import type { ResponseEndMethod, WrappedResponseEndMethod } from '../types'; diff --git a/packages/nextjs/src/common/utils/tracingUtils.ts b/packages/nextjs/src/common/utils/tracingUtils.ts index e849e502913f..ff57fcae3acc 100644 --- a/packages/nextjs/src/common/utils/tracingUtils.ts +++ b/packages/nextjs/src/common/utils/tracingUtils.ts @@ -1,6 +1,6 @@ import { Scope, getActiveSpan, getRootSpan, spanToJSON, startNewTrace } from '@sentry/core'; -import { GLOBAL_OBJ, logger } from '@sentry/core'; import type { PropagationContext } from '@sentry/types'; +import { GLOBAL_OBJ, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { TRANSACTION_ATTR_SHOULD_DROP_TRANSACTION } from '../span-attributes-with-logic-attached'; diff --git a/packages/nextjs/src/common/utils/wrapperUtils.ts b/packages/nextjs/src/common/utils/wrapperUtils.ts index 202a0f2e9c37..159ee669ec09 100644 --- a/packages/nextjs/src/common/utils/wrapperUtils.ts +++ b/packages/nextjs/src/common/utils/wrapperUtils.ts @@ -6,7 +6,6 @@ import { getIsolationScope, getRootSpan, getTraceData, - httpRequestToRequestData, } from '@sentry/core'; import { TRANSACTION_ATTR_SENTRY_ROUTE_BACKFILL } from '../span-attributes-with-logic-attached'; @@ -62,9 +61,10 @@ export function withTracedServerSideDataFetcher Pr this: unknown, ...args: Parameters ): Promise<{ data: ReturnType; sentryTrace?: string; baggage?: string }> { - const normalizedRequest = httpRequestToRequestData(req); getCurrentScope().setTransactionName(`${options.dataFetchingMethodName} (${options.dataFetcherRouteName})`); - getIsolationScope().setSDKProcessingMetadata({ normalizedRequest }); + getIsolationScope().setSDKProcessingMetadata({ + request: req, + }); const span = getActiveSpan(); diff --git a/packages/nextjs/src/common/withServerActionInstrumentation.ts b/packages/nextjs/src/common/withServerActionInstrumentation.ts index 5a9320fd143a..b13d3ebef3dd 100644 --- a/packages/nextjs/src/common/withServerActionInstrumentation.ts +++ b/packages/nextjs/src/common/withServerActionInstrumentation.ts @@ -9,8 +9,7 @@ import { startSpan, withIsolationScope, } from '@sentry/core'; -import { logger, vercelWaitUntil } from '@sentry/core'; -import type { RequestEventData } from '@sentry/types'; +import { logger, vercelWaitUntil } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import { isNotFoundNavigationError, isRedirectNavigationError } from './nextNavigationErrorUtils'; @@ -90,9 +89,9 @@ async function withServerActionInstrumentationImplementation a scope.setTransactionName(`${componentType}.${generationFunctionIdentifier} (${componentRoute})`); isolationScope.setSDKProcessingMetadata({ - normalizedRequest: { + request: { headers: headersDict, - } satisfies RequestEventData, + }, }); const activeSpan = getActiveSpan(); diff --git a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts index 058d856dfd81..e8b57c7d2b8b 100644 --- a/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts +++ b/packages/nextjs/src/common/wrapMiddlewareWithSentry.ts @@ -8,11 +8,10 @@ import { handleCallbackErrors, setCapturedScopesOnSpan, startSpan, - vercelWaitUntil, - winterCGRequestToRequestData, withIsolationScope, } from '@sentry/core'; import type { TransactionSource } from '@sentry/types'; +import { vercelWaitUntil, winterCGRequestToRequestData } from '@sentry/utils'; import type { EdgeRouteHandler } from '../edge/types'; import { flushSafelyWithTimeout } from './utils/responseEnd'; @@ -37,7 +36,7 @@ export function wrapMiddlewareWithSentry( if (req instanceof Request) { isolationScope.setSDKProcessingMetadata({ - normalizedRequest: winterCGRequestToRequestData(req), + request: winterCGRequestToRequestData(req), }); spanName = `middleware ${req.method} ${new URL(req.url).pathname}`; spanSource = 'url'; diff --git a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts index 82bd208f9946..215bb35ce9a5 100644 --- a/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapRouteHandlerWithSentry.ts @@ -13,10 +13,10 @@ import { withIsolationScope, withScope, } from '@sentry/core'; -import type { RequestEventData } from '@sentry/types'; + import type { RouteHandlerContext } from './types'; -import { propagationContextFromHeaders, winterCGHeadersToDict } from '@sentry/core'; +import { propagationContextFromHeaders, winterCGHeadersToDict } from '@sentry/utils'; import { isNotFoundNavigationError, isRedirectNavigationError } from './nextNavigationErrorUtils'; import { commonObjectToIsolationScope } from './utils/tracingUtils'; @@ -64,10 +64,10 @@ export function wrapRouteHandlerWithSentry any>( ); scope.setPropagationContext(incomingPropagationContext); scope.setSDKProcessingMetadata({ - normalizedRequest: { + request: { method, headers: completeHeadersDict, - } satisfies RequestEventData, + }, }); } diff --git a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts index 15536665c988..c4bbde29eb53 100644 --- a/packages/nextjs/src/common/wrapServerComponentWithSentry.ts +++ b/packages/nextjs/src/common/wrapServerComponentWithSentry.ts @@ -13,8 +13,7 @@ import { withIsolationScope, withScope, } from '@sentry/core'; -import { propagationContextFromHeaders, uuid4, vercelWaitUntil, winterCGHeadersToDict } from '@sentry/core'; -import type { RequestEventData } from '@sentry/types'; +import { propagationContextFromHeaders, uuid4, vercelWaitUntil, winterCGHeadersToDict } from '@sentry/utils'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { isNotFoundNavigationError, isRedirectNavigationError } from '../common/nextNavigationErrorUtils'; @@ -50,9 +49,9 @@ export function wrapServerComponentWithSentry any> const headersDict = context.headers ? winterCGHeadersToDict(context.headers) : undefined; isolationScope.setSDKProcessingMetadata({ - normalizedRequest: { + request: { headers: headersDict, - } satisfies RequestEventData, + }, }); return withIsolationScope(isolationScope, () => { diff --git a/packages/nextjs/src/config/loaders/prefixLoader.ts b/packages/nextjs/src/config/loaders/prefixLoader.ts index 82185130ebb2..29920a7047be 100644 --- a/packages/nextjs/src/config/loaders/prefixLoader.ts +++ b/packages/nextjs/src/config/loaders/prefixLoader.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import { escapeStringForRegex } from '@sentry/core'; +import { escapeStringForRegex } from '@sentry/utils'; import type { LoaderThis } from './types'; diff --git a/packages/nextjs/src/config/loaders/wrappingLoader.ts b/packages/nextjs/src/config/loaders/wrappingLoader.ts index 324dd1b1b1ad..d18d0efd7634 100644 --- a/packages/nextjs/src/config/loaders/wrappingLoader.ts +++ b/packages/nextjs/src/config/loaders/wrappingLoader.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; import commonjs from '@rollup/plugin-commonjs'; -import { stringMatchesSomePattern } from '@sentry/core'; +import { stringMatchesSomePattern } from '@sentry/utils'; import * as chalk from 'chalk'; import type { RollupBuild, RollupError } from 'rollup'; import { rollup } from 'rollup'; diff --git a/packages/nextjs/src/config/types.ts b/packages/nextjs/src/config/types.ts index 75b1c29281fa..14be35215cf2 100644 --- a/packages/nextjs/src/config/types.ts +++ b/packages/nextjs/src/config/types.ts @@ -1,4 +1,4 @@ -import type { GLOBAL_OBJ } from '@sentry/core'; +import type { GLOBAL_OBJ } from '@sentry/utils'; import type { SentryWebpackPluginOptions } from '@sentry/webpack-plugin'; // The first argument to `withSentryConfig` (which is the user's next config). diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 026622318e3f..b83008a4817e 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -3,8 +3,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { arrayify, escapeStringForRegex, loadModule, logger } from '@sentry/core'; import { getSentryRelease } from '@sentry/node'; +import { arrayify, escapeStringForRegex, loadModule, logger } from '@sentry/utils'; import * as chalk from 'chalk'; import { sync as resolveSync } from 'resolve'; diff --git a/packages/nextjs/src/config/withSentryConfig.ts b/packages/nextjs/src/config/withSentryConfig.ts index 4c815498b1db..539e75c20596 100644 --- a/packages/nextjs/src/config/withSentryConfig.ts +++ b/packages/nextjs/src/config/withSentryConfig.ts @@ -1,5 +1,5 @@ /* eslint-disable complexity */ -import { isThenable, parseSemver } from '@sentry/core'; +import { isThenable, parseSemver } from '@sentry/utils'; import * as fs from 'fs'; import { sync as resolveSync } from 'resolve'; diff --git a/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts b/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts index b9a72d8d95b3..d2e1b519c29b 100644 --- a/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts +++ b/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts @@ -1,5 +1,5 @@ import { defineIntegration, rewriteFramesIntegration } from '@sentry/core'; -import { escapeStringForRegex } from '@sentry/core'; +import { escapeStringForRegex } from '@sentry/utils'; export const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }: { distDirName: string }) => { const distDirAbsPath = distDirName.replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index ba66c0ba9560..5bfc8cca054b 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -8,7 +8,7 @@ import { spanToJSON, } from '@sentry/core'; -import { GLOBAL_OBJ, stripUrlQueryAndFragment, vercelWaitUntil } from '@sentry/core'; +import { GLOBAL_OBJ, stripUrlQueryAndFragment, vercelWaitUntil } from '@sentry/utils'; import type { VercelEdgeOptions } from '@sentry/vercel-edge'; import { getDefaultIntegrations, init as vercelEdgeInit } from '@sentry/vercel-edge'; diff --git a/packages/nextjs/src/edge/rewriteFramesIntegration.ts b/packages/nextjs/src/edge/rewriteFramesIntegration.ts index b191488c2b68..15a541311ed1 100644 --- a/packages/nextjs/src/edge/rewriteFramesIntegration.ts +++ b/packages/nextjs/src/edge/rewriteFramesIntegration.ts @@ -1,6 +1,6 @@ import { defineIntegration, rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/core'; -import { GLOBAL_OBJ, escapeStringForRegex } from '@sentry/core'; import type { IntegrationFn, StackFrame } from '@sentry/types'; +import { GLOBAL_OBJ, escapeStringForRegex } from '@sentry/utils'; const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & { _sentryRewriteFramesDistDir?: string; diff --git a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts index fa31511e4c28..5c8ce043ecb8 100644 --- a/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/edge/wrapApiHandlerWithSentry.ts @@ -11,7 +11,7 @@ import { startSpan, withIsolationScope, } from '@sentry/core'; -import { vercelWaitUntil, winterCGRequestToRequestData } from '@sentry/core'; +import { vercelWaitUntil, winterCGRequestToRequestData } from '@sentry/utils'; import { flushSafelyWithTimeout } from '../common/utils/responseEnd'; import type { EdgeRouteHandler } from './types'; @@ -32,7 +32,7 @@ export function wrapApiHandlerWithSentry( if (req instanceof Request) { isolationScope.setSDKProcessingMetadata({ - normalizedRequest: winterCGRequestToRequestData(req), + request: winterCGRequestToRequestData(req), }); currentScope.setTransactionName(`${req.method} ${parameterizedRoute}`); } else { diff --git a/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts b/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts index dfa61ff44b98..8ac80d91d61c 100644 --- a/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts +++ b/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts @@ -1,6 +1,6 @@ import * as path from 'path'; import { defineIntegration, rewriteFramesIntegration } from '@sentry/core'; -import { escapeStringForRegex } from '@sentry/core'; +import { escapeStringForRegex } from '@sentry/utils'; export const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }: { distDirName: string }) => { // nextjs always puts the build directory at the project root level, which is also where you run `next start` from, so diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index c79c35932e5b..bdff0de922b2 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -12,9 +12,9 @@ import { setCapturedScopesOnSpan, spanToJSON, } from '@sentry/core'; -import { GLOBAL_OBJ, extractTraceparentData, logger, stripUrlQueryAndFragment } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { getDefaultIntegrations, httpIntegration, init as nodeInit } from '@sentry/node'; +import { GLOBAL_OBJ, extractTraceparentData, logger, stripUrlQueryAndFragment } from '@sentry/utils'; import { context } from '@opentelemetry/api'; import { diff --git a/packages/nextjs/src/server/rewriteFramesIntegration.ts b/packages/nextjs/src/server/rewriteFramesIntegration.ts index 0c8af92fb958..33bc7d90cb99 100644 --- a/packages/nextjs/src/server/rewriteFramesIntegration.ts +++ b/packages/nextjs/src/server/rewriteFramesIntegration.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import { defineIntegration, rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/core'; -import { escapeStringForRegex } from '@sentry/core'; import type { IntegrationFn, StackFrame } from '@sentry/types'; +import { escapeStringForRegex } from '@sentry/utils'; const globalWithInjectedValues = global as typeof global & { _sentryRewriteFramesDistDir?: string; diff --git a/packages/nextjs/test/clientSdk.test.ts b/packages/nextjs/test/clientSdk.test.ts index eafe07547ffb..f136b29e6887 100644 --- a/packages/nextjs/test/clientSdk.test.ts +++ b/packages/nextjs/test/clientSdk.test.ts @@ -1,8 +1,8 @@ import { getGlobalScope, getIsolationScope } from '@sentry/core'; -import { logger } from '@sentry/core'; import * as SentryReact from '@sentry/react'; import { WINDOW, getClient, getCurrentScope } from '@sentry/react'; import type { Integration } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { JSDOM } from 'jsdom'; import { breadcrumbsIntegration, browserTracingIntegration, init } from '../src/client'; diff --git a/packages/nextjs/test/serverSdk.test.ts b/packages/nextjs/test/serverSdk.test.ts index d37a1c46d015..fed88fe25d33 100644 --- a/packages/nextjs/test/serverSdk.test.ts +++ b/packages/nextjs/test/serverSdk.test.ts @@ -1,7 +1,7 @@ -import { GLOBAL_OBJ } from '@sentry/core'; import { getCurrentScope } from '@sentry/node'; import * as SentryNode from '@sentry/node'; import type { Integration } from '@sentry/types'; +import { GLOBAL_OBJ } from '@sentry/utils'; import { init } from '../src/server'; diff --git a/packages/nextjs/test/types/test.ts b/packages/nextjs/test/types/test.ts index f9f45d29f29b..d9b5f059958c 100644 --- a/packages/nextjs/test/types/test.ts +++ b/packages/nextjs/test/types/test.ts @@ -1,6 +1,6 @@ import { execSync } from 'child_process'; /* eslint-disable no-console */ -import { parseSemver } from '@sentry/core'; +import { parseSemver } from '@sentry/utils'; const NODE_VERSION = parseSemver(process.versions.node); diff --git a/packages/node/package.json b/packages/node/package.json index 6b6aee9f8ed3..3b36652a7755 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -100,6 +100,7 @@ "@sentry/core": "8.39.0", "@sentry/opentelemetry": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "import-in-the-middle": "^1.11.2" }, "devDependencies": { diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 2df1e48767ce..cc81dce37577 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -21,7 +21,6 @@ export { mongooseIntegration } from './integrations/tracing/mongoose'; export { mysqlIntegration } from './integrations/tracing/mysql'; export { mysql2Integration } from './integrations/tracing/mysql2'; export { redisIntegration } from './integrations/tracing/redis'; -// eslint-disable-next-line deprecation/deprecation export { nestIntegration, setupNestErrorHandler } from './integrations/tracing/nest/nest'; export { postgresIntegration } from './integrations/tracing/postgres'; export { prismaIntegration } from './integrations/tracing/prisma'; @@ -57,7 +56,7 @@ export { cron } from './cron'; export type { NodeOptions } from './types'; -export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/core'; +export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils'; export { addOpenTelemetryInstrumentation, @@ -115,12 +114,10 @@ export { captureMessage, captureFeedback, captureConsoleIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, // eslint-disable-next-line deprecation/deprecation metricsDefault as metrics, diff --git a/packages/node/src/integrations/anr/index.ts b/packages/node/src/integrations/anr/index.ts index 1fa2218d5879..c5f5b28e0888 100644 --- a/packages/node/src/integrations/anr/index.ts +++ b/packages/node/src/integrations/anr/index.ts @@ -1,8 +1,8 @@ import * as diagnosticsChannel from 'node:diagnostics_channel'; import { Worker } from 'node:worker_threads'; import { defineIntegration, getCurrentScope, getGlobalScope, getIsolationScope, mergeScopeData } from '@sentry/core'; -import { GLOBAL_OBJ, getFilenameToDebugIdMap, logger } from '@sentry/core'; import type { Contexts, Event, EventHint, Integration, IntegrationFn, ScopeData } from '@sentry/types'; +import { GLOBAL_OBJ, getFilenameToDebugIdMap, logger } from '@sentry/utils'; import { NODE_VERSION } from '../../nodeVersion'; import type { NodeClient } from '../../sdk/client'; import type { AnrIntegrationOptions, WorkerStartData } from './common'; diff --git a/packages/node/src/integrations/anr/worker.ts b/packages/node/src/integrations/anr/worker.ts index bada36db274e..8e20fbeeb39a 100644 --- a/packages/node/src/integrations/anr/worker.ts +++ b/packages/node/src/integrations/anr/worker.ts @@ -8,14 +8,14 @@ import { makeSession, updateSession, } from '@sentry/core'; +import type { DebugImage, Event, ScopeData, Session, StackFrame } from '@sentry/types'; import { callFrameToStackFrame, normalizeUrlToBase, stripSentryFramesAndReverse, uuid4, watchdogTimer, -} from '@sentry/core'; -import type { DebugImage, Event, ScopeData, Session, StackFrame } from '@sentry/types'; +} from '@sentry/utils'; import { makeNodeTransport } from '../../transports'; import { createGetModuleFromFilename } from '../../utils/module'; diff --git a/packages/node/src/integrations/console.ts b/packages/node/src/integrations/console.ts index 9413ed6da4bf..4a7cea53ec90 100644 --- a/packages/node/src/integrations/console.ts +++ b/packages/node/src/integrations/console.ts @@ -1,6 +1,6 @@ import * as util from 'node:util'; import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; -import { addConsoleInstrumentationHandler, severityLevelFromString, truncate } from '@sentry/core'; +import { addConsoleInstrumentationHandler, severityLevelFromString, truncate } from '@sentry/utils'; const INTEGRATION_NAME = 'Console'; diff --git a/packages/node/src/integrations/contextlines.ts b/packages/node/src/integrations/contextlines.ts index 5c77b0e845f1..2a3fa3e12b53 100644 --- a/packages/node/src/integrations/contextlines.ts +++ b/packages/node/src/integrations/contextlines.ts @@ -1,8 +1,8 @@ import { createReadStream } from 'node:fs'; import { createInterface } from 'node:readline'; import { defineIntegration } from '@sentry/core'; -import { LRUMap, logger, snipLine } from '@sentry/core'; import type { Event, IntegrationFn, StackFrame } from '@sentry/types'; +import { LRUMap, logger, snipLine } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/node/src/integrations/http/SentryHttpInstrumentation.ts b/packages/node/src/integrations/http/SentryHttpInstrumentation.ts index 4d948c9d37c4..b17810adb601 100644 --- a/packages/node/src/integrations/http/SentryHttpInstrumentation.ts +++ b/packages/node/src/integrations/http/SentryHttpInstrumentation.ts @@ -5,19 +5,15 @@ import { VERSION } from '@opentelemetry/core'; import type { InstrumentationConfig } from '@opentelemetry/instrumentation'; import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; import { getRequestInfo } from '@opentelemetry/instrumentation-http'; +import { addBreadcrumb, getClient, getIsolationScope, withIsolationScope } from '@sentry/core'; +import type { PolymorphicRequest, RequestEventData, SanitizedRequestData } from '@sentry/types'; import { - addBreadcrumb, getBreadcrumbLogLevelFromHttpStatusCode, - getClient, - getIsolationScope, getSanitizedUrlString, - httpRequestToRequestData, logger, parseUrl, stripUrlQueryAndFragment, - withIsolationScope, -} from '@sentry/core'; -import type { RequestEventData, SanitizedRequestData, Scope } from '@sentry/types'; +} from '@sentry/utils'; import { DEBUG_BUILD } from '../../debug-build'; import type { NodeClient } from '../../sdk/client'; import { getRequestUrl } from '../../utils/getRequestUrl'; @@ -133,19 +129,31 @@ export class SentryHttpInstrumentation extends InstrumentationBase'; + const protocol = request.socket && (request.socket as { encrypted?: boolean }).encrypted ? 'https' : 'http'; + const originalUrl = request.url || ''; + const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; + + // This is non-standard, but may be set on e.g. Next.js or Express requests + const cookies = (request as PolymorphicRequest).cookies; + + const normalizedRequest: RequestEventData = { + url: absoluteUrl, + method: request.method, + query_string: extractQueryParams(request), + headers: headersToDict(request.headers), + cookies, + }; - patchRequestToCaptureBody(request, isolationScope); + patchRequestToCaptureBody(request, normalizedRequest); // Update the isolation scope, isolate this request - // TODO(v9): Stop setting `request`, we only rely on normalizedRequest anymore - isolationScope.setSDKProcessingMetadata({ - request, - normalizedRequest, - }); + isolationScope.setSDKProcessingMetadata({ request, normalizedRequest }); const client = getClient(); if (client && client.getOptions().autoSessionTracking) { @@ -339,7 +347,7 @@ function getBreadcrumbData(request: http.ClientRequest): Partial): Record { + const headers: Record = Object.create(null); + + try { + Object.entries(reqHeaders).forEach(([key, value]) => { + if (typeof value === 'string') { + headers[key] = value; + } + }); + } catch (e) { + DEBUG_BUILD && + logger.warn('Sentry failed extracting headers from a request object. If you see this, please file an issue.'); + } + + return headers; +} diff --git a/packages/node/src/integrations/local-variables/local-variables-async.ts b/packages/node/src/integrations/local-variables/local-variables-async.ts index 19a67db88057..d46fa224019f 100644 --- a/packages/node/src/integrations/local-variables/local-variables-async.ts +++ b/packages/node/src/integrations/local-variables/local-variables-async.ts @@ -1,7 +1,7 @@ import { Worker } from 'node:worker_threads'; import { defineIntegration } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { Event, EventHint, Exception, IntegrationFn } from '@sentry/types'; +import { logger } from '@sentry/utils'; import type { NodeClient } from '../../sdk/client'; import type { FrameVariables, LocalVariablesIntegrationOptions, LocalVariablesWorkerArgs } from './common'; diff --git a/packages/node/src/integrations/local-variables/local-variables-sync.ts b/packages/node/src/integrations/local-variables/local-variables-sync.ts index 454de1d9d356..d3203614330f 100644 --- a/packages/node/src/integrations/local-variables/local-variables-sync.ts +++ b/packages/node/src/integrations/local-variables/local-variables-sync.ts @@ -1,7 +1,7 @@ import type { Debugger, InspectorNotification, Runtime, Session } from 'node:inspector'; import { defineIntegration, getClient } from '@sentry/core'; -import { LRUMap, logger } from '@sentry/core'; import type { Event, Exception, IntegrationFn, StackFrame, StackParser } from '@sentry/types'; +import { LRUMap, logger } from '@sentry/utils'; import { NODE_MAJOR } from '../../nodeVersion'; import type { NodeClient } from '../../sdk/client'; diff --git a/packages/node/src/integrations/local-variables/worker.ts b/packages/node/src/integrations/local-variables/worker.ts index b00c8ca3b9c7..91fb5957cb01 100644 --- a/packages/node/src/integrations/local-variables/worker.ts +++ b/packages/node/src/integrations/local-variables/worker.ts @@ -1,7 +1,7 @@ import type { Debugger, InspectorNotification, Runtime } from 'node:inspector'; import { Session } from 'node:inspector/promises'; import { workerData } from 'node:worker_threads'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; import type { LocalVariablesWorkerArgs, PausedExceptionEvent, RateLimitIncrement, Variables } from './common'; import { LOCAL_VARIABLES_KEY } from './common'; import { createRateLimiter } from './common'; diff --git a/packages/node/src/integrations/modules.ts b/packages/node/src/integrations/modules.ts index 9a48dc82464a..f434319b5bae 100644 --- a/packages/node/src/integrations/modules.ts +++ b/packages/node/src/integrations/modules.ts @@ -1,8 +1,8 @@ import { existsSync, readFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { defineIntegration } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { isCjs } from '../utils/commonjs'; diff --git a/packages/node/src/integrations/node-fetch.ts b/packages/node/src/integrations/node-fetch.ts index d02fa53f789f..60abee504758 100644 --- a/packages/node/src/integrations/node-fetch.ts +++ b/packages/node/src/integrations/node-fetch.ts @@ -8,13 +8,13 @@ import { getCurrentScope, hasTracingEnabled, } from '@sentry/core'; -import { getBreadcrumbLogLevelFromHttpStatusCode, getSanitizedUrlString, parseUrl } from '@sentry/core'; import { addOpenTelemetryInstrumentation, generateSpanContextForPropagationContext, getPropagationContextFromSpan, } from '@sentry/opentelemetry'; import type { IntegrationFn, SanitizedRequestData } from '@sentry/types'; +import { getBreadcrumbLogLevelFromHttpStatusCode, getSanitizedUrlString, parseUrl } from '@sentry/utils'; interface NodeFetchOptions { /** diff --git a/packages/node/src/integrations/onuncaughtexception.ts b/packages/node/src/integrations/onuncaughtexception.ts index d0e728119fc2..637174f12351 100644 --- a/packages/node/src/integrations/onuncaughtexception.ts +++ b/packages/node/src/integrations/onuncaughtexception.ts @@ -1,6 +1,6 @@ import { captureException, defineIntegration } from '@sentry/core'; import { getClient } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import type { NodeClient } from '../sdk/client'; diff --git a/packages/node/src/integrations/onunhandledrejection.ts b/packages/node/src/integrations/onunhandledrejection.ts index a30881d89d4b..e1bc0b4145cf 100644 --- a/packages/node/src/integrations/onunhandledrejection.ts +++ b/packages/node/src/integrations/onunhandledrejection.ts @@ -1,6 +1,6 @@ import { captureException, defineIntegration, getClient } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/types'; +import { consoleSandbox } from '@sentry/utils'; import { logAndExitProcess } from '../utils/errorhandling'; type UnhandledRejectionMode = 'none' | 'warn' | 'strict'; diff --git a/packages/node/src/integrations/spotlight.ts b/packages/node/src/integrations/spotlight.ts index 20828dab4eb6..1021827312be 100644 --- a/packages/node/src/integrations/spotlight.ts +++ b/packages/node/src/integrations/spotlight.ts @@ -1,7 +1,7 @@ import * as http from 'node:http'; import { defineIntegration } from '@sentry/core'; -import { logger, serializeEnvelope } from '@sentry/core'; import type { Client, Envelope, IntegrationFn } from '@sentry/types'; +import { logger, serializeEnvelope } from '@sentry/utils'; type SpotlightConnectionOptions = { /** diff --git a/packages/node/src/integrations/tracing/express.ts b/packages/node/src/integrations/tracing/express.ts index 3db47f551ccb..0b4b6aa35c3e 100644 --- a/packages/node/src/integrations/tracing/express.ts +++ b/packages/node/src/integrations/tracing/express.ts @@ -2,8 +2,8 @@ import type * as http from 'node:http'; import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, defineIntegration, getDefaultIsolationScope, spanToJSON } from '@sentry/core'; import { captureException, getClient, getIsolationScope } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../debug-build'; import { generateInstrumentOnce } from '../../otel/instrument'; import type { NodeClient } from '../../sdk/client'; diff --git a/packages/node/src/integrations/tracing/hapi/index.ts b/packages/node/src/integrations/tracing/hapi/index.ts index 113c37bfc90b..9d1015704d60 100644 --- a/packages/node/src/integrations/tracing/hapi/index.ts +++ b/packages/node/src/integrations/tracing/hapi/index.ts @@ -10,8 +10,8 @@ import { getIsolationScope, spanToJSON, } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { IntegrationFn, Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../../debug-build'; import { generateInstrumentOnce } from '../../../otel/instrument'; import { ensureIsWrapped } from '../../../utils/ensureIsWrapped'; diff --git a/packages/node/src/integrations/tracing/index.ts b/packages/node/src/integrations/tracing/index.ts index c8f6348aeee0..1a1b8835011d 100644 --- a/packages/node/src/integrations/tracing/index.ts +++ b/packages/node/src/integrations/tracing/index.ts @@ -38,7 +38,6 @@ export function getAutoPerformanceIntegrations(): Integration[] { // See https://github.com/prisma/prisma/issues/23410 // TODO v8: Figure out a better solution for this, maybe only disable in ESM mode? // prismaIntegration(), - // eslint-disable-next-line deprecation/deprecation nestIntegration(), hapiIntegration(), koaIntegration(), @@ -65,7 +64,6 @@ export function getOpenTelemetryInstrumentationToPreload(): (((options?: any) => instrumentKafka, instrumentKoa, instrumentLruMemoizer, - // eslint-disable-next-line deprecation/deprecation instrumentNest, instrumentMongo, instrumentMongoose, diff --git a/packages/node/src/integrations/tracing/koa.ts b/packages/node/src/integrations/tracing/koa.ts index 26ecea2133b1..a244c6cb56d7 100644 --- a/packages/node/src/integrations/tracing/koa.ts +++ b/packages/node/src/integrations/tracing/koa.ts @@ -9,8 +9,8 @@ import { getIsolationScope, spanToJSON, } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { IntegrationFn, Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../debug-build'; import { generateInstrumentOnce } from '../../otel/instrument'; import { ensureIsWrapped } from '../../utils/ensureIsWrapped'; diff --git a/packages/node/src/integrations/tracing/nest/helpers.ts b/packages/node/src/integrations/tracing/nest/helpers.ts index 236a54ae2a42..04dab67f65b0 100644 --- a/packages/node/src/integrations/tracing/nest/helpers.ts +++ b/packages/node/src/integrations/tracing/nest/helpers.ts @@ -1,6 +1,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, withActiveSpan } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { addNonEnumerableProperty } from '@sentry/utils'; import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types'; const sentryPatched = 'sentryPatched'; diff --git a/packages/node/src/integrations/tracing/nest/nest.ts b/packages/node/src/integrations/tracing/nest/nest.ts index f21a3fd3eae6..2520367d1361 100644 --- a/packages/node/src/integrations/tracing/nest/nest.ts +++ b/packages/node/src/integrations/tracing/nest/nest.ts @@ -9,8 +9,8 @@ import { getIsolationScope, spanToJSON, } from '@sentry/core'; -import { consoleSandbox, logger } from '@sentry/core'; -import type { Span } from '@sentry/types'; +import type { IntegrationFn, Span } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { generateInstrumentOnce } from '../../../otel/instrument'; import { SentryNestEventInstrumentation } from './sentry-nest-event-instrumentation'; import { SentryNestInstrumentation } from './sentry-nest-instrumentation'; @@ -39,35 +39,26 @@ export const instrumentNest = Object.assign( { id: INTEGRATION_NAME }, ); -/** - * Integration capturing tracing data for NestJS. - * - * @deprecated The `nestIntegration` is deprecated. Instead, use the NestJS SDK directly (`@sentry/nestjs`), or use the `nestIntegration` export from `@sentry/nestjs`. - */ -export const nestIntegration = defineIntegration(() => { +const _nestIntegration = (() => { return { name: INTEGRATION_NAME, setupOnce() { instrumentNest(); }, }; -}); +}) satisfies IntegrationFn; /** - * Setup an error handler for Nest. + * Nest framework integration * - * @deprecated `setupNestErrorHandler` is deprecated. - * Instead use the `@sentry/nestjs` package, which has more functional APIs for capturing errors. - * See the [`@sentry/nestjs` Setup Guide](https://docs.sentry.io/platforms/javascript/guides/nestjs/) for how to set up the Sentry NestJS SDK. + * Capture tracing data for nest. */ -export function setupNestErrorHandler(app: MinimalNestJsApp, baseFilter: NestJsErrorFilter): void { - consoleSandbox(() => { - // eslint-disable-next-line no-console - console.warn( - '[Sentry] Warning: You used the `setupNestErrorHandler()` method to set up Sentry error monitoring. This function is deprecated and will be removed in the next major version. Instead, it is recommended to use the `@sentry/nestjs` package. To set up the NestJS SDK see: https://docs.sentry.io/platforms/javascript/guides/nestjs/', - ); - }); +export const nestIntegration = defineIntegration(_nestIntegration); +/** + * Setup an error handler for Nest. + */ +export function setupNestErrorHandler(app: MinimalNestJsApp, baseFilter: NestJsErrorFilter): void { // Sadly, NestInstrumentation has no requestHook, so we need to add the attributes here // We register this hook in this method, because if we register it in the integration `setup`, // it would always run even for users that are not even using Nest.js diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts index 59dac31b8218..16333c7fc6c3 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-event-instrumentation.ts @@ -6,7 +6,7 @@ import { InstrumentationNodeModuleFile, } from '@opentelemetry/instrumentation'; import { captureException, startSpan } from '@sentry/core'; -import { SDK_VERSION } from '@sentry/core'; +import { SDK_VERSION } from '@sentry/utils'; import { getEventSpanOptions } from './helpers'; import type { OnEventTarget } from './types'; diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index 66449995ac1e..2d59d97d87fd 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -6,8 +6,8 @@ import { InstrumentationNodeModuleFile, } from '@opentelemetry/instrumentation'; import { getActiveSpan, startInactiveSpan, startSpan, startSpanManual, withActiveSpan } from '@sentry/core'; -import { SDK_VERSION, addNonEnumerableProperty, isThenable } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { SDK_VERSION, addNonEnumerableProperty, isThenable } from '@sentry/utils'; import { getMiddlewareSpanOptions, getNextProxy, instrumentObservable, isPatched } from './helpers'; import type { CallHandler, CatchTarget, InjectableTarget, MinimalNestJsExecutionContext, Observable } from './types'; diff --git a/packages/node/src/integrations/tracing/redis.ts b/packages/node/src/integrations/tracing/redis.ts index 7888aaf66be3..cf30d8f953f3 100644 --- a/packages/node/src/integrations/tracing/redis.ts +++ b/packages/node/src/integrations/tracing/redis.ts @@ -11,8 +11,8 @@ import { defineIntegration, spanToJSON, } from '@sentry/core'; -import { truncate } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; +import { truncate } from '@sentry/utils'; import { generateInstrumentOnce } from '../../otel/instrument'; import { GET_COMMANDS, diff --git a/packages/node/src/nodeVersion.ts b/packages/node/src/nodeVersion.ts index 1ec745743620..1f07883b771b 100644 --- a/packages/node/src/nodeVersion.ts +++ b/packages/node/src/nodeVersion.ts @@ -1,4 +1,4 @@ -import { parseSemver } from '@sentry/core'; +import { parseSemver } from '@sentry/utils'; export const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number }; export const NODE_MAJOR = NODE_VERSION.major; diff --git a/packages/node/src/proxy/index.ts b/packages/node/src/proxy/index.ts index 0b6f5b2c5196..b5e289729607 100644 --- a/packages/node/src/proxy/index.ts +++ b/packages/node/src/proxy/index.ts @@ -32,7 +32,7 @@ import type * as http from 'node:http'; import type { OutgoingHttpHeaders } from 'node:http'; import * as net from 'node:net'; import * as tls from 'node:tls'; -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; import { Agent } from './base'; import type { AgentConnectOpts } from './base'; import { parseProxyResponse } from './parse-proxy-response'; diff --git a/packages/node/src/proxy/parse-proxy-response.ts b/packages/node/src/proxy/parse-proxy-response.ts index a2c05b1dbe2c..f1878a4e377b 100644 --- a/packages/node/src/proxy/parse-proxy-response.ts +++ b/packages/node/src/proxy/parse-proxy-response.ts @@ -30,7 +30,7 @@ /* eslint-disable jsdoc/require-jsdoc */ import type { IncomingHttpHeaders } from 'node:http'; import type { Readable } from 'node:stream'; -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; function debug(...args: unknown[]): void { logger.log('[https-proxy-agent:parse-proxy-response]', ...args); diff --git a/packages/node/src/sdk/api.ts b/packages/node/src/sdk/api.ts index e7b09a18b4a4..d5c28a258fdc 100644 --- a/packages/node/src/sdk/api.ts +++ b/packages/node/src/sdk/api.ts @@ -1,7 +1,7 @@ // PUBLIC APIS -import { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/core'; import type { StackParser } from '@sentry/types'; +import { GLOBAL_OBJ, createStackParser, nodeStackLineParser } from '@sentry/utils'; import { createGetModuleFromFilename } from '../utils/module'; /** diff --git a/packages/node/src/sdk/client.ts b/packages/node/src/sdk/client.ts index 8179d40e2819..877b363d3b2a 100644 --- a/packages/node/src/sdk/client.ts +++ b/packages/node/src/sdk/client.ts @@ -4,7 +4,7 @@ import { trace } from '@opentelemetry/api'; import type { BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; import type { ServerRuntimeClientOptions } from '@sentry/core'; import { SDK_VERSION, ServerRuntimeClient, applySdkMetadata } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; import { isMainThread, threadId } from 'worker_threads'; import { DEBUG_BUILD } from '../debug-build'; import type { NodeClientOptions } from '../types'; diff --git a/packages/node/src/sdk/index.ts b/packages/node/src/sdk/index.ts index 2a64fb0d904f..edebeea384db 100644 --- a/packages/node/src/sdk/index.ts +++ b/packages/node/src/sdk/index.ts @@ -11,13 +11,6 @@ import { requestDataIntegration, startSession, } from '@sentry/core'; -import { - consoleSandbox, - dropUndefinedKeys, - logger, - propagationContextFromHeaders, - stackParserFromStackParserOptions, -} from '@sentry/core'; import { enhanceDscWithOpenTelemetryRootSpanName, openTelemetrySetupCheck, @@ -25,6 +18,13 @@ import { setupEventContextTrace, } from '@sentry/opentelemetry'; import type { Integration, Options } from '@sentry/types'; +import { + consoleSandbox, + dropUndefinedKeys, + logger, + propagationContextFromHeaders, + stackParserFromStackParserOptions, +} from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import { consoleIntegration } from '../integrations/console'; import { nodeContextIntegration } from '../integrations/context'; diff --git a/packages/node/src/sdk/initOtel.ts b/packages/node/src/sdk/initOtel.ts index fd37e5ef477f..c5ec5367f68c 100644 --- a/packages/node/src/sdk/initOtel.ts +++ b/packages/node/src/sdk/initOtel.ts @@ -8,8 +8,8 @@ import { SEMRESATTRS_SERVICE_NAMESPACE, } from '@opentelemetry/semantic-conventions'; import { SDK_VERSION } from '@sentry/core'; -import { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/core'; import { SentryPropagator, SentrySampler, SentrySpanProcessor } from '@sentry/opentelemetry'; +import { GLOBAL_OBJ, consoleSandbox, logger } from '@sentry/utils'; import { createAddHookMessageChannel } from 'import-in-the-middle'; import { getOpenTelemetryInstrumentationToPreload } from '../integrations/tracing'; diff --git a/packages/node/src/transports/http.ts b/packages/node/src/transports/http.ts index ce3b34dbc909..c4f13c89ee1b 100644 --- a/packages/node/src/transports/http.ts +++ b/packages/node/src/transports/http.ts @@ -3,7 +3,6 @@ import * as https from 'node:https'; import { Readable } from 'node:stream'; import { createGzip } from 'node:zlib'; import { createTransport, suppressTracing } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; import type { BaseTransportOptions, Transport, @@ -11,6 +10,7 @@ import type { TransportRequest, TransportRequestExecutor, } from '@sentry/types'; +import { consoleSandbox } from '@sentry/utils'; import { HttpsProxyAgent } from '../proxy'; import type { HTTPModule } from './http-module'; diff --git a/packages/node/src/utils/ensureIsWrapped.ts b/packages/node/src/utils/ensureIsWrapped.ts index 26bf8799fb42..a11c60f949d5 100644 --- a/packages/node/src/utils/ensureIsWrapped.ts +++ b/packages/node/src/utils/ensureIsWrapped.ts @@ -1,6 +1,6 @@ import { isWrapped } from '@opentelemetry/core'; import { getClient, getGlobalScope, hasTracingEnabled, isEnabled } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; import type { NodeClient } from '../sdk/client'; import { isCjs } from './commonjs'; import { createMissingInstrumentationContext } from './createMissingInstrumentationContext'; diff --git a/packages/node/src/utils/errorhandling.ts b/packages/node/src/utils/errorhandling.ts index a6a255c53fd7..3e08ca5d2ff4 100644 --- a/packages/node/src/utils/errorhandling.ts +++ b/packages/node/src/utils/errorhandling.ts @@ -1,5 +1,5 @@ import { getClient } from '@sentry/core'; -import { consoleSandbox, logger } from '@sentry/core'; +import { consoleSandbox, logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; import type { NodeClient } from '../sdk/client'; diff --git a/packages/node/src/utils/module.ts b/packages/node/src/utils/module.ts index b5470269b921..aad8195d1b1f 100644 --- a/packages/node/src/utils/module.ts +++ b/packages/node/src/utils/module.ts @@ -1,5 +1,5 @@ import { posix, sep } from 'node:path'; -import { dirname } from '@sentry/core'; +import { dirname } from '@sentry/utils'; /** normalizes Windows paths */ function normalizeWindowsPath(path: string): string { diff --git a/packages/node/src/utils/redisCache.ts b/packages/node/src/utils/redisCache.ts index cb411f304cf7..7c9cff30f9d9 100644 --- a/packages/node/src/utils/redisCache.ts +++ b/packages/node/src/utils/redisCache.ts @@ -1,5 +1,5 @@ import type { CommandArgs as IORedisCommandArgs } from '@opentelemetry/instrumentation-ioredis'; -import { flatten } from '@sentry/core'; +import { flatten } from '@sentry/utils'; const SINGLE_ARG_COMMANDS = ['get', 'set', 'setex']; diff --git a/packages/node/test/helpers/conditional.ts b/packages/node/test/helpers/conditional.ts index 01e64d8804df..7c6ecab77cd7 100644 --- a/packages/node/test/helpers/conditional.ts +++ b/packages/node/test/helpers/conditional.ts @@ -1,4 +1,4 @@ -import { parseSemver } from '@sentry/core'; +import { parseSemver } from '@sentry/utils'; const NODE_VERSION = parseSemver(process.versions.node).major; diff --git a/packages/node/test/helpers/getDefaultNodeClientOptions.ts b/packages/node/test/helpers/getDefaultNodeClientOptions.ts index a8479150c18a..ec42177a1335 100644 --- a/packages/node/test/helpers/getDefaultNodeClientOptions.ts +++ b/packages/node/test/helpers/getDefaultNodeClientOptions.ts @@ -1,5 +1,5 @@ import { createTransport } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; +import { resolvedSyncPromise } from '@sentry/utils'; import type { NodeClientOptions } from '../../src/types'; diff --git a/packages/node/test/integration/console.test.ts b/packages/node/test/integration/console.test.ts index 9d4d5a415ee5..d869959ebdfc 100644 --- a/packages/node/test/integration/console.test.ts +++ b/packages/node/test/integration/console.test.ts @@ -1,5 +1,5 @@ import * as SentryCore from '@sentry/core'; -import { resetInstrumentationHandlers } from '@sentry/core'; +import { resetInstrumentationHandlers } from '@sentry/utils'; import { getClient } from '../../src'; import type { NodeClient } from '../../src'; import { consoleIntegration } from '../../src/integrations/console'; diff --git a/packages/node/test/integration/transactions.test.ts b/packages/node/test/integration/transactions.test.ts index e13d239821d3..5c77b81e6994 100644 --- a/packages/node/test/integration/transactions.test.ts +++ b/packages/node/test/integration/transactions.test.ts @@ -1,9 +1,9 @@ import { TraceFlags, context, trace } from '@opentelemetry/api'; import type { SpanProcessor } from '@opentelemetry/sdk-trace-base'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; -import { logger } from '@sentry/core'; import { SentrySpanProcessor } from '@sentry/opentelemetry'; import type { TransactionEvent } from '@sentry/types'; +import { logger } from '@sentry/utils'; import * as Sentry from '../../src'; import { cleanupOtel, getProvider, mockSdkInit } from '../helpers/mockSdkInit'; diff --git a/packages/node/test/integrations/contextlines.test.ts b/packages/node/test/integrations/contextlines.test.ts index 4c609b22a3f4..56af4a3e58e8 100644 --- a/packages/node/test/integrations/contextlines.test.ts +++ b/packages/node/test/integrations/contextlines.test.ts @@ -1,6 +1,6 @@ import * as fs from 'node:fs'; -import { parseStackFrames } from '@sentry/core'; import type { StackFrame } from '@sentry/types'; +import { parseStackFrames } from '@sentry/utils'; import { MAX_CONTEXTLINES_COLNO, diff --git a/packages/node/test/integrations/spotlight.test.ts b/packages/node/test/integrations/spotlight.test.ts index c78c81fdba14..6b888c22edcd 100644 --- a/packages/node/test/integrations/spotlight.test.ts +++ b/packages/node/test/integrations/spotlight.test.ts @@ -1,6 +1,6 @@ import * as http from 'http'; -import { createEnvelope, logger } from '@sentry/core'; import type { Envelope, EventEnvelope } from '@sentry/types'; +import { createEnvelope, logger } from '@sentry/utils'; import { spotlightIntegration } from '../../src/integrations/spotlight'; import { NodeClient } from '../../src/sdk/client'; diff --git a/packages/node/test/sdk/init.test.ts b/packages/node/test/sdk/init.test.ts index 3444b6e43582..10a7a56ae8bd 100644 --- a/packages/node/test/sdk/init.test.ts +++ b/packages/node/test/sdk/init.test.ts @@ -1,5 +1,5 @@ -import { logger } from '@sentry/core'; import type { Integration } from '@sentry/types'; +import { logger } from '@sentry/utils'; import * as SentryOpentelemetry from '@sentry/opentelemetry'; import { getClient, getIsolationScope } from '../../src/'; diff --git a/packages/node/test/sdk/preload.test.ts b/packages/node/test/sdk/preload.test.ts index 70dffe039a82..fedba139b0f6 100644 --- a/packages/node/test/sdk/preload.test.ts +++ b/packages/node/test/sdk/preload.test.ts @@ -1,4 +1,4 @@ -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; describe('preload', () => { afterEach(() => { diff --git a/packages/node/test/transports/http.test.ts b/packages/node/test/transports/http.test.ts index 445db5f14c95..e945c086959a 100644 --- a/packages/node/test/transports/http.test.ts +++ b/packages/node/test/transports/http.test.ts @@ -1,8 +1,8 @@ import * as http from 'http'; import { createGunzip } from 'zlib'; import { createTransport } from '@sentry/core'; -import { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, serializeEnvelope } from '@sentry/core'; import type { EventEnvelope, EventItem } from '@sentry/types'; +import { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, serializeEnvelope } from '@sentry/utils'; import { makeNodeTransport } from '../../src/transports'; diff --git a/packages/node/test/transports/https.test.ts b/packages/node/test/transports/https.test.ts index f907086698e1..8b0d3312ba54 100644 --- a/packages/node/test/transports/https.test.ts +++ b/packages/node/test/transports/https.test.ts @@ -1,8 +1,8 @@ import * as http from 'http'; import * as https from 'https'; import { createTransport } from '@sentry/core'; -import { createEnvelope, serializeEnvelope } from '@sentry/core'; import type { EventEnvelope, EventItem } from '@sentry/types'; +import { createEnvelope, serializeEnvelope } from '@sentry/utils'; import { makeNodeTransport } from '../../src/transports'; import type { HTTPModule, HTTPModuleRequestIncomingMessage } from '../../src/transports/http-module'; diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 2d15fb2500e6..8c8375b3d919 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -49,6 +49,7 @@ "@sentry/opentelemetry": "8.39.0", "@sentry/rollup-plugin": "2.22.6", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@sentry/vite-plugin": "2.22.6", "@sentry/vue": "8.39.0" }, diff --git a/packages/nuxt/src/client/piniaIntegration.ts b/packages/nuxt/src/client/piniaIntegration.ts index e5e838267363..28b797fb9fa6 100644 --- a/packages/nuxt/src/client/piniaIntegration.ts +++ b/packages/nuxt/src/client/piniaIntegration.ts @@ -1,7 +1,7 @@ import { defineIntegration } from '@sentry/core'; import type { IntegrationFn } from '@sentry/types'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; import { createSentryPiniaPlugin } from '@sentry/vue'; const INTEGRATION_NAME = 'Pinia'; diff --git a/packages/nuxt/src/module.ts b/packages/nuxt/src/module.ts index 5a684998da5a..426ab2f41edf 100644 --- a/packages/nuxt/src/module.ts +++ b/packages/nuxt/src/module.ts @@ -1,6 +1,6 @@ import * as path from 'path'; import { addPlugin, addPluginTemplate, addServerPlugin, createResolver, defineNuxtModule } from '@nuxt/kit'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; import type { SentryNuxtModuleOptions } from './common/types'; import { addDynamicImportEntryFileWrapper, addServerConfigToBuild } from './vite/addServerConfig'; import { setupSourceMaps } from './vite/sourceMaps'; diff --git a/packages/nuxt/src/runtime/utils.ts b/packages/nuxt/src/runtime/utils.ts index 54819fd9bd77..7b56a258f708 100644 --- a/packages/nuxt/src/runtime/utils.ts +++ b/packages/nuxt/src/runtime/utils.ts @@ -1,6 +1,6 @@ import { captureException, getClient, getTraceMetaTags } from '@sentry/core'; -import { dropUndefinedKeys } from '@sentry/core'; import type { ClientOptions, Context } from '@sentry/types'; +import { dropUndefinedKeys } from '@sentry/utils'; import type { VueOptions } from '@sentry/vue/src/types'; import type { CapturedErrorContext } from 'nitropack'; import type { NuxtRenderHTMLContext } from 'nuxt/app'; diff --git a/packages/nuxt/src/server/sdk.ts b/packages/nuxt/src/server/sdk.ts index 81ab93e6ccb2..59832bbb2a39 100644 --- a/packages/nuxt/src/server/sdk.ts +++ b/packages/nuxt/src/server/sdk.ts @@ -1,5 +1,4 @@ import { applySdkMetadata, flush, getGlobalScope } from '@sentry/core'; -import { logger, vercelWaitUntil } from '@sentry/core'; import { type NodeOptions, getDefaultIntegrations as getDefaultNodeIntegrations, @@ -7,6 +6,7 @@ import { init as initNode, } from '@sentry/node'; import type { Client, EventProcessor, Integration } from '@sentry/types'; +import { logger, vercelWaitUntil } from '@sentry/utils'; import { DEBUG_BUILD } from '../common/debug-build'; import type { SentryNuxtServerOptions } from '../common/types'; diff --git a/packages/nuxt/src/vite/addServerConfig.ts b/packages/nuxt/src/vite/addServerConfig.ts index 5ac673b3dd20..824b46781e0d 100644 --- a/packages/nuxt/src/vite/addServerConfig.ts +++ b/packages/nuxt/src/vite/addServerConfig.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import { createResolver } from '@nuxt/kit'; import type { Nuxt } from '@nuxt/schema'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; import type { Nitro } from 'nitropack'; import type { InputPluginOption } from 'rollup'; import type { SentryNuxtModuleOptions } from '../common/types'; diff --git a/packages/nuxt/src/vite/sourceMaps.ts b/packages/nuxt/src/vite/sourceMaps.ts index beea7e18d8f2..8fd6f0a381fd 100644 --- a/packages/nuxt/src/vite/sourceMaps.ts +++ b/packages/nuxt/src/vite/sourceMaps.ts @@ -1,6 +1,6 @@ import type { Nuxt } from '@nuxt/schema'; -import { consoleSandbox } from '@sentry/core'; import { type SentryRollupPluginOptions, sentryRollupPlugin } from '@sentry/rollup-plugin'; +import { consoleSandbox } from '@sentry/utils'; import { type SentryVitePluginOptions, sentryVitePlugin } from '@sentry/vite-plugin'; import type { NitroConfig } from 'nitropack'; import type { OutputOptions } from 'rollup'; diff --git a/packages/nuxt/src/vite/utils.ts b/packages/nuxt/src/vite/utils.ts index d18fd1dcc484..8fffc8fe06c9 100644 --- a/packages/nuxt/src/vite/utils.ts +++ b/packages/nuxt/src/vite/utils.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import { consoleSandbox, flatten } from '@sentry/core'; +import { consoleSandbox, flatten } from '@sentry/utils'; /** * Find the default SDK init file for the given type (client or server). diff --git a/packages/nuxt/test/runtime/utils.test.ts b/packages/nuxt/test/runtime/utils.test.ts index 9c3dd568d67a..a6afc03b05da 100644 --- a/packages/nuxt/test/runtime/utils.test.ts +++ b/packages/nuxt/test/runtime/utils.test.ts @@ -81,16 +81,10 @@ describe('extractErrorContext', () => { }); describe('reportNuxtError', () => { - vi.mock('@sentry/core', async importOriginal => { - const actual = await importOriginal(); - return { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - ...actual, - captureException: vi.fn(), - getClient: vi.fn(), - }; - }); + vi.mock('@sentry/core', () => ({ + captureException: vi.fn(), + getClient: vi.fn(), + })); const mockError = new Error('Test error'); diff --git a/packages/opentelemetry/package.json b/packages/opentelemetry/package.json index dbaa4d9f2794..9cc175a31649 100644 --- a/packages/opentelemetry/package.json +++ b/packages/opentelemetry/package.json @@ -40,7 +40,8 @@ }, "dependencies": { "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "peerDependencies": { "@opentelemetry/api": "^1.9.0", diff --git a/packages/opentelemetry/src/propagator.ts b/packages/opentelemetry/src/propagator.ts index 054a348fd7b5..f4fcb1fa91e9 100644 --- a/packages/opentelemetry/src/propagator.ts +++ b/packages/opentelemetry/src/propagator.ts @@ -14,6 +14,7 @@ import { getDynamicSamplingContextFromSpan, getIsolationScope, } from '@sentry/core'; +import type { DynamicSamplingContext, Options, PropagationContext } from '@sentry/types'; import { LRUMap, SENTRY_BAGGAGE_KEY_PREFIX, @@ -23,8 +24,7 @@ import { parseBaggageHeader, propagationContextFromHeaders, stringMatchesSomePattern, -} from '@sentry/core'; -import type { DynamicSamplingContext, Options, PropagationContext } from '@sentry/types'; +} from '@sentry/utils'; import { SENTRY_BAGGAGE_HEADER, diff --git a/packages/opentelemetry/src/sampler.ts b/packages/opentelemetry/src/sampler.ts index b5cfc2ee5514..3438b4b6bbca 100644 --- a/packages/opentelemetry/src/sampler.ts +++ b/packages/opentelemetry/src/sampler.ts @@ -10,8 +10,8 @@ import { hasTracingEnabled, sampleSpan, } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { Client, SpanAttributes } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING, SENTRY_TRACE_STATE_URL } from './constants'; import { diff --git a/packages/opentelemetry/src/setupEventContextTrace.ts b/packages/opentelemetry/src/setupEventContextTrace.ts index 051b1cba1364..f2e1454a02df 100644 --- a/packages/opentelemetry/src/setupEventContextTrace.ts +++ b/packages/opentelemetry/src/setupEventContextTrace.ts @@ -1,6 +1,6 @@ import { getDynamicSamplingContextFromSpan, getRootSpan } from '@sentry/core'; -import { dropUndefinedKeys } from '@sentry/core'; import type { Client } from '@sentry/types'; +import { dropUndefinedKeys } from '@sentry/utils'; import { SENTRY_TRACE_STATE_PARENT_SPAN_ID } from './constants'; import { getActiveSpan } from './utils/getActiveSpan'; import { spanHasParentId } from './utils/spanTypes'; diff --git a/packages/opentelemetry/src/spanExporter.ts b/packages/opentelemetry/src/spanExporter.ts index 11d822f66ec1..a9fa207ade6b 100644 --- a/packages/opentelemetry/src/spanExporter.ts +++ b/packages/opentelemetry/src/spanExporter.ts @@ -17,8 +17,8 @@ import { getStatusMessage, spanTimeInputToSeconds, } from '@sentry/core'; -import { dropUndefinedKeys, logger } from '@sentry/core'; import type { SpanJSON, SpanOrigin, TraceContext, TransactionEvent, TransactionSource } from '@sentry/types'; +import { dropUndefinedKeys, logger } from '@sentry/utils'; import { SENTRY_TRACE_STATE_PARENT_SPAN_ID } from './constants'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/opentelemetry/src/utils/contextData.ts b/packages/opentelemetry/src/utils/contextData.ts index e91b91ffe223..8cf0833b0150 100644 --- a/packages/opentelemetry/src/utils/contextData.ts +++ b/packages/opentelemetry/src/utils/contextData.ts @@ -1,6 +1,6 @@ import type { Context } from '@opentelemetry/api'; -import { addNonEnumerableProperty } from '@sentry/core'; import type { Scope } from '@sentry/types'; +import { addNonEnumerableProperty } from '@sentry/utils'; import { SENTRY_SCOPES_CONTEXT_KEY } from '../constants'; import type { CurrentScopes } from '../types'; diff --git a/packages/opentelemetry/src/utils/getRequestSpanData.ts b/packages/opentelemetry/src/utils/getRequestSpanData.ts index 1ba4e374fc6c..ee723b3ca335 100644 --- a/packages/opentelemetry/src/utils/getRequestSpanData.ts +++ b/packages/opentelemetry/src/utils/getRequestSpanData.ts @@ -6,8 +6,8 @@ import { SEMATTRS_HTTP_METHOD, SEMATTRS_HTTP_URL, } from '@opentelemetry/semantic-conventions'; -import { getSanitizedUrlString, parseUrl } from '@sentry/core'; import type { SanitizedRequestData } from '@sentry/types'; +import { getSanitizedUrlString, parseUrl } from '@sentry/utils'; import { spanHasAttributes } from './spanTypes'; diff --git a/packages/opentelemetry/src/utils/getSamplingDecision.ts b/packages/opentelemetry/src/utils/getSamplingDecision.ts index 216b5249224e..05e2aba26525 100644 --- a/packages/opentelemetry/src/utils/getSamplingDecision.ts +++ b/packages/opentelemetry/src/utils/getSamplingDecision.ts @@ -1,6 +1,6 @@ import type { SpanContext } from '@opentelemetry/api'; import { TraceFlags } from '@opentelemetry/api'; -import { baggageHeaderToDynamicSamplingContext } from '@sentry/core'; +import { baggageHeaderToDynamicSamplingContext } from '@sentry/utils'; import { SENTRY_TRACE_STATE_DSC, SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING } from '../constants'; /** diff --git a/packages/opentelemetry/src/utils/getTraceData.ts b/packages/opentelemetry/src/utils/getTraceData.ts index 8d91c74bd294..d85f6f699ef3 100644 --- a/packages/opentelemetry/src/utils/getTraceData.ts +++ b/packages/opentelemetry/src/utils/getTraceData.ts @@ -1,6 +1,6 @@ import * as api from '@opentelemetry/api'; -import { dropUndefinedKeys } from '@sentry/core'; import type { SerializedTraceData } from '@sentry/types'; +import { dropUndefinedKeys } from '@sentry/utils'; /** * Otel-specific implementation of `getTraceData`. diff --git a/packages/opentelemetry/src/utils/makeTraceState.ts b/packages/opentelemetry/src/utils/makeTraceState.ts index e292274cade0..1b4fb4971efc 100644 --- a/packages/opentelemetry/src/utils/makeTraceState.ts +++ b/packages/opentelemetry/src/utils/makeTraceState.ts @@ -1,6 +1,6 @@ import { TraceState } from '@opentelemetry/core'; -import { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/core'; import type { DynamicSamplingContext } from '@sentry/types'; +import { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils'; import { SENTRY_TRACE_STATE_DSC, SENTRY_TRACE_STATE_PARENT_SPAN_ID, diff --git a/packages/opentelemetry/src/utils/parseSpanDescription.ts b/packages/opentelemetry/src/utils/parseSpanDescription.ts index aff1fc5e2d69..8a07f2aadc2a 100644 --- a/packages/opentelemetry/src/utils/parseSpanDescription.ts +++ b/packages/opentelemetry/src/utils/parseSpanDescription.ts @@ -13,8 +13,8 @@ import { SEMATTRS_MESSAGING_SYSTEM, SEMATTRS_RPC_SERVICE, } from '@opentelemetry/semantic-conventions'; -import { getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from '@sentry/core'; import type { SpanAttributes, TransactionSource } from '@sentry/types'; +import { getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from '@sentry/utils'; import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION } from '../semanticAttributes'; diff --git a/packages/opentelemetry/test/helpers/TestClient.ts b/packages/opentelemetry/test/helpers/TestClient.ts index 18a169c0a817..d284df690fbc 100644 --- a/packages/opentelemetry/test/helpers/TestClient.ts +++ b/packages/opentelemetry/test/helpers/TestClient.ts @@ -1,6 +1,6 @@ import { BaseClient, createTransport, getCurrentScope } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { Client, ClientOptions, Event, Options, SeverityLevel } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; import { wrapClientClass } from '../../src/custom/client'; import type { OpenTelemetryClient } from '../../src/types'; diff --git a/packages/opentelemetry/test/helpers/createSpan.ts b/packages/opentelemetry/test/helpers/createSpan.ts index 0e3672f5abe3..e68a82986dea 100644 --- a/packages/opentelemetry/test/helpers/createSpan.ts +++ b/packages/opentelemetry/test/helpers/createSpan.ts @@ -2,7 +2,7 @@ import type { Context, SpanContext, TimeInput } from '@opentelemetry/api'; import { SpanKind } from '@opentelemetry/api'; import type { Tracer } from '@opentelemetry/sdk-trace-base'; import { Span } from '@opentelemetry/sdk-trace-base'; -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; export function createSpan( name?: string, diff --git a/packages/opentelemetry/test/helpers/initOtel.ts b/packages/opentelemetry/test/helpers/initOtel.ts index 7e59400cc1b1..ad527d936413 100644 --- a/packages/opentelemetry/test/helpers/initOtel.ts +++ b/packages/opentelemetry/test/helpers/initOtel.ts @@ -8,7 +8,7 @@ import { SEMRESATTRS_SERVICE_NAMESPACE, } from '@opentelemetry/semantic-conventions'; import { SDK_VERSION, getClient } from '@sentry/core'; -import { logger } from '@sentry/core'; +import { logger } from '@sentry/utils'; import { wrapContextManagerClass } from '../../src/contextManager'; import { DEBUG_BUILD } from '../../src/debug-build'; diff --git a/packages/opentelemetry/test/integration/transactions.test.ts b/packages/opentelemetry/test/integration/transactions.test.ts index b66147a413d7..bab3f03d1f64 100644 --- a/packages/opentelemetry/test/integration/transactions.test.ts +++ b/packages/opentelemetry/test/integration/transactions.test.ts @@ -11,8 +11,8 @@ import { startSpanManual, withIsolationScope, } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { Event, TransactionEvent } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { TraceState } from '@opentelemetry/core'; import { SENTRY_TRACE_STATE_DSC } from '../../src/constants'; diff --git a/packages/profiling-node/package.json b/packages/profiling-node/package.json index d9d8097c7a6f..27aed43e8136 100644 --- a/packages/profiling-node/package.json +++ b/packages/profiling-node/package.json @@ -78,6 +78,7 @@ "@sentry/core": "8.39.0", "@sentry/node": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "detect-libc": "^2.0.2", "node-abi": "^3.61.0" }, diff --git a/packages/profiling-node/src/cpu_profiler.ts b/packages/profiling-node/src/cpu_profiler.ts index 76fad9a286a6..51d0279ba31b 100644 --- a/packages/profiling-node/src/cpu_profiler.ts +++ b/packages/profiling-node/src/cpu_profiler.ts @@ -5,7 +5,7 @@ import { threadId } from 'node:worker_threads'; import { familySync } from 'detect-libc'; import { getAbi } from 'node-abi'; -import { GLOBAL_OBJ, logger } from '@sentry/core'; +import { GLOBAL_OBJ, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import type { PrivateV8CpuProfilerBindings, diff --git a/packages/profiling-node/src/integration.ts b/packages/profiling-node/src/integration.ts index 65bab5084d3e..1af7b8d82dea 100644 --- a/packages/profiling-node/src/integration.ts +++ b/packages/profiling-node/src/integration.ts @@ -11,7 +11,7 @@ import { import type { NodeClient } from '@sentry/node'; import type { Event, IntegrationFn, Profile, ProfileChunk, ProfilingIntegration, Span } from '@sentry/types'; -import { LRUMap, consoleSandbox, logger, uuid4 } from '@sentry/core'; +import { LRUMap, consoleSandbox, logger, uuid4 } from '@sentry/utils'; import { CpuProfilerBindings } from './cpu_profiler'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/profiling-node/src/nodeVersion.ts b/packages/profiling-node/src/nodeVersion.ts index 1ec745743620..1f07883b771b 100644 --- a/packages/profiling-node/src/nodeVersion.ts +++ b/packages/profiling-node/src/nodeVersion.ts @@ -1,4 +1,4 @@ -import { parseSemver } from '@sentry/core'; +import { parseSemver } from '@sentry/utils'; export const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number }; export const NODE_MAJOR = NODE_VERSION.major; diff --git a/packages/profiling-node/src/spanProfileUtils.ts b/packages/profiling-node/src/spanProfileUtils.ts index 75c78b6dfc6b..ee6d29b8bb93 100644 --- a/packages/profiling-node/src/spanProfileUtils.ts +++ b/packages/profiling-node/src/spanProfileUtils.ts @@ -1,7 +1,7 @@ import { spanIsSampled, spanToJSON } from '@sentry/core'; -import { logger, uuid4 } from '@sentry/core'; import type { NodeClient } from '@sentry/node'; import type { CustomSamplingContext, Span } from '@sentry/types'; +import { logger, uuid4 } from '@sentry/utils'; import { CpuProfilerBindings } from './cpu_profiler'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/profiling-node/src/utils.ts b/packages/profiling-node/src/utils.ts index c6051a90978f..2693467d1f47 100644 --- a/packages/profiling-node/src/utils.ts +++ b/packages/profiling-node/src/utils.ts @@ -1,13 +1,5 @@ /* eslint-disable max-lines */ import * as os from 'os'; -import { - createEnvelope, - dsnToString, - forEachEnvelopeItem, - getDebugImagesForResources, - logger, - uuid4, -} from '@sentry/core'; import type { Client, Context, @@ -24,6 +16,14 @@ import type { SdkInfo, ThreadCpuProfile, } from '@sentry/types'; +import { + createEnvelope, + dsnToString, + forEachEnvelopeItem, + getDebugImagesForResources, + logger, + uuid4, +} from '@sentry/utils'; import { env, versions } from 'process'; import { isMainThread, threadId } from 'worker_threads'; diff --git a/packages/profiling-node/test/spanProfileUtils.test.ts b/packages/profiling-node/test/spanProfileUtils.test.ts index e679001994da..c5619eaaae85 100644 --- a/packages/profiling-node/test/spanProfileUtils.test.ts +++ b/packages/profiling-node/test/spanProfileUtils.test.ts @@ -1,10 +1,10 @@ import * as Sentry from '@sentry/node'; import { getMainCarrier } from '@sentry/core'; -import { GLOBAL_OBJ, createEnvelope, logger } from '@sentry/core'; import type { NodeClientOptions } from '@sentry/node/build/types/types'; import type { ProfilingIntegration } from '@sentry/types'; import type { ProfileChunk, Transport } from '@sentry/types'; +import { GLOBAL_OBJ, createEnvelope, logger } from '@sentry/utils'; import { CpuProfilerBindings } from '../src/cpu_profiler'; import { _nodeProfilingIntegration } from '../src/integration'; diff --git a/packages/profiling-node/test/utils.test.ts b/packages/profiling-node/test/utils.test.ts index 9d834f1dc9b3..fe661e41f07f 100644 --- a/packages/profiling-node/test/utils.test.ts +++ b/packages/profiling-node/test/utils.test.ts @@ -1,5 +1,5 @@ -import { addItemToEnvelope, createEnvelope, uuid4 } from '@sentry/core'; import type { Event } from '@sentry/types'; +import { addItemToEnvelope, createEnvelope, uuid4 } from '@sentry/utils'; import { addProfilesToEnvelope, diff --git a/packages/react/package.json b/packages/react/package.json index 122edb0ecd3f..fa8857e1c01b 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -42,6 +42,7 @@ "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "hoist-non-react-statics": "^3.3.2" }, "peerDependencies": { diff --git a/packages/react/src/error.ts b/packages/react/src/error.ts index 09121c3c85c2..ce83e39e33ee 100644 --- a/packages/react/src/error.ts +++ b/packages/react/src/error.ts @@ -1,6 +1,6 @@ import { captureException } from '@sentry/browser'; -import { isError } from '@sentry/core'; import type { EventHint } from '@sentry/types'; +import { isError } from '@sentry/utils'; import { version } from 'react'; import type { ErrorInfo } from 'react'; diff --git a/packages/react/src/errorboundary.tsx b/packages/react/src/errorboundary.tsx index 84b2ac464e9d..abd532c29a53 100644 --- a/packages/react/src/errorboundary.tsx +++ b/packages/react/src/errorboundary.tsx @@ -1,7 +1,7 @@ import type { ReportDialogOptions } from '@sentry/browser'; import { getClient, showReportDialog, withScope } from '@sentry/browser'; -import { logger } from '@sentry/core'; import type { Scope } from '@sentry/types'; +import { logger } from '@sentry/utils'; import hoistNonReactStatics from 'hoist-non-react-statics'; import * as React from 'react'; diff --git a/packages/react/src/profiler.tsx b/packages/react/src/profiler.tsx index 26585d83ae64..611425b04df0 100644 --- a/packages/react/src/profiler.tsx +++ b/packages/react/src/profiler.tsx @@ -1,7 +1,7 @@ import { startInactiveSpan } from '@sentry/browser'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, withActiveSpan } from '@sentry/core'; -import { timestampInSeconds } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { timestampInSeconds } from '@sentry/utils'; import hoistNonReactStatics from 'hoist-non-react-statics'; import * as React from 'react'; diff --git a/packages/react/src/reactrouterv6.tsx b/packages/react/src/reactrouterv6.tsx index b209391f1dda..2576ba664f40 100644 --- a/packages/react/src/reactrouterv6.tsx +++ b/packages/react/src/reactrouterv6.tsx @@ -18,8 +18,8 @@ import { getRootSpan, spanToJSON, } from '@sentry/core'; -import { getNumberOfUrlSegments, logger } from '@sentry/core'; import type { Client, Integration, Span, TransactionSource } from '@sentry/types'; +import { getNumberOfUrlSegments, logger } from '@sentry/utils'; import hoistNonReactStatics from 'hoist-non-react-statics'; import * as React from 'react'; diff --git a/packages/react/src/redux.ts b/packages/react/src/redux.ts index c3dea1b517c7..b9d6b951f7d2 100644 --- a/packages/react/src/redux.ts +++ b/packages/react/src/redux.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { addBreadcrumb, getClient, getCurrentScope, getGlobalScope } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; import type { Scope } from '@sentry/types'; +import { addNonEnumerableProperty } from '@sentry/utils'; interface Action { type: T; diff --git a/packages/remix/package.json b/packages/remix/package.json index 57a4c525b0ad..3bd66fa85443 100644 --- a/packages/remix/package.json +++ b/packages/remix/package.json @@ -59,6 +59,7 @@ "@sentry/opentelemetry": "8.39.0", "@sentry/react": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "glob": "^10.3.4", "opentelemetry-instrumentation-remix": "0.7.1", "yargs": "^17.6.0" diff --git a/packages/remix/src/client/errors.tsx b/packages/remix/src/client/errors.tsx index 8aa5e2e85dfb..b46f5fde069a 100644 --- a/packages/remix/src/client/errors.tsx +++ b/packages/remix/src/client/errors.tsx @@ -1,5 +1,5 @@ import { captureException } from '@sentry/core'; -import { isNodeEnv } from '@sentry/core'; +import { isNodeEnv } from '@sentry/utils'; import { isResponse } from '../utils/vendor/response'; diff --git a/packages/remix/src/client/performance.tsx b/packages/remix/src/client/performance.tsx index 83028abc3862..cbb886a6dc8b 100644 --- a/packages/remix/src/client/performance.tsx +++ b/packages/remix/src/client/performance.tsx @@ -5,7 +5,6 @@ import { getCurrentScope, getRootSpan, } from '@sentry/core'; -import { isNodeEnv, logger } from '@sentry/core'; import type { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/react'; import type { BrowserClient, ErrorBoundaryProps } from '@sentry/react'; import { @@ -16,6 +15,7 @@ import { withErrorBoundary, } from '@sentry/react'; import type { Client, StartSpanOptions } from '@sentry/types'; +import { isNodeEnv, logger } from '@sentry/utils'; import * as React from 'react'; import { DEBUG_BUILD } from '../utils/debug-build'; diff --git a/packages/remix/src/index.client.tsx b/packages/remix/src/index.client.tsx index f75581f14a68..615287bed17b 100644 --- a/packages/remix/src/index.client.tsx +++ b/packages/remix/src/index.client.tsx @@ -1,7 +1,7 @@ import { applySdkMetadata } from '@sentry/core'; -import { logger } from '@sentry/core'; import { init as reactInit } from '@sentry/react'; import type { Client } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from './utils/debug-build'; import type { RemixOptions } from './utils/remixOptions'; export { captureRemixErrorBoundaryError } from './client/errors'; diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index d61f759dbf38..1291a3fb8767 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -1,8 +1,8 @@ import { applySdkMetadata } from '@sentry/core'; -import { logger } from '@sentry/core'; import type { NodeClient, NodeOptions } from '@sentry/node'; import { getDefaultIntegrations as getDefaultNodeIntegrations, init as nodeInit, isInitialized } from '@sentry/node'; import type { Integration } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from './utils/debug-build'; import { instrumentServer } from './utils/instrumentServer'; @@ -35,7 +35,6 @@ export { createGetModuleFromFilename, createTransport, cron, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, @@ -84,7 +83,6 @@ export { mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, NodeClient, nodeContextIntegration, @@ -102,7 +100,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, setContext, setCurrentClient, @@ -116,7 +113,6 @@ export { setupExpressErrorHandler, setupHapiErrorHandler, setupKoaErrorHandler, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, setUser, spanToBaggageHeader, diff --git a/packages/remix/src/utils/errors.ts b/packages/remix/src/utils/errors.ts index d2e040bcd05c..100dac496c75 100644 --- a/packages/remix/src/utils/errors.ts +++ b/packages/remix/src/utils/errors.ts @@ -1,20 +1,13 @@ import type { AppData, DataFunctionArgs, EntryContext, HandleDocumentRequestFunction } from '@remix-run/node'; -import { - addExceptionMechanism, - captureException, - getClient, - handleCallbackErrors, - isPrimitive, - logger, - objectify, - winterCGRequestToRequestData, -} from '@sentry/core'; -import type { RequestEventData, Span } from '@sentry/types'; +import { captureException, getClient, handleCallbackErrors } from '@sentry/core'; +import type { Span } from '@sentry/types'; +import { addExceptionMechanism, isPrimitive, logger, objectify } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import type { RemixOptions } from './remixOptions'; import { storeFormDataKeys } from './utils'; import { extractData, isResponse, isRouteErrorResponse } from './vendor/response'; import type { DataFunction, RemixRequest } from './vendor/types'; +import { normalizeRemixRequest } from './web-fetch'; /** * Captures an exception happened in the Remix server. @@ -48,10 +41,12 @@ export async function captureRemixServerException( return; } - let normalizedRequest: RequestEventData = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let normalizedRequest: Record = request as unknown as any; try { - normalizedRequest = winterCGRequestToRequestData(request); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + normalizedRequest = normalizeRemixRequest(request as unknown as any); } catch (e) { DEBUG_BUILD && logger.warn('Failed to normalize Remix request'); } @@ -59,7 +54,11 @@ export async function captureRemixServerException( const objectifiedErr = objectify(err); captureException(isResponse(objectifiedErr) ? await extractResponseError(objectifiedErr) : objectifiedErr, scope => { - scope.setSDKProcessingMetadata({ normalizedRequest }); + scope.setSDKProcessingMetadata({ + request: { + ...normalizedRequest, + }, + }); scope.addEventProcessor(event => { addExceptionMechanism(event, { diff --git a/packages/remix/src/utils/futureFlags.ts b/packages/remix/src/utils/futureFlags.ts index 63c9c5dff2ef..03d03270a73e 100644 --- a/packages/remix/src/utils/futureFlags.ts +++ b/packages/remix/src/utils/futureFlags.ts @@ -1,4 +1,4 @@ -import { GLOBAL_OBJ } from '@sentry/core'; +import { GLOBAL_OBJ } from '@sentry/utils'; import type { FutureConfig, ServerBuild } from './vendor/types'; diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts index ac1382bc5e00..666c332afa04 100644 --- a/packages/remix/src/utils/instrumentServer.ts +++ b/packages/remix/src/utils/instrumentServer.ts @@ -11,13 +11,12 @@ import { spanToJSON, spanToTraceHeader, startSpan, - winterCGRequestToRequestData, withIsolationScope, } from '@sentry/core'; -import { dynamicSamplingContextToSentryBaggageHeader, fill, isNodeEnv, loadModule, logger } from '@sentry/core'; import { continueTrace, getDynamicSamplingContextFromSpan } from '@sentry/opentelemetry'; -import type { RequestEventData, TransactionSource, WrappedFunction } from '@sentry/types'; +import type { TransactionSource, WrappedFunction } from '@sentry/types'; import type { Span } from '@sentry/types'; +import { dynamicSamplingContextToSentryBaggageHeader, fill, isNodeEnv, loadModule, logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import { captureRemixServerException, errorHandleDataFunction, errorHandleDocumentRequestFunction } from './errors'; @@ -40,6 +39,7 @@ import type { ServerRoute, ServerRouteManifest, } from './vendor/types'; +import { normalizeRemixRequest } from './web-fetch'; let FUTURE_FLAGS: FutureConfig | undefined; @@ -296,10 +296,10 @@ function wrapRequestHandler( return withIsolationScope(async isolationScope => { const options = getClient()?.getOptions(); - let normalizedRequest: RequestEventData = {}; + let normalizedRequest: Record = request; try { - normalizedRequest = winterCGRequestToRequestData(request); + normalizedRequest = normalizeRemixRequest(request); } catch (e) { DEBUG_BUILD && logger.warn('Failed to normalize Remix request'); } @@ -311,7 +311,11 @@ function wrapRequestHandler( isolationScope.setTransactionName(name); } - isolationScope.setSDKProcessingMetadata({ normalizedRequest }); + isolationScope.setSDKProcessingMetadata({ + request: { + ...normalizedRequest, + }, + }); if (!options || !hasTracingEnabled(options)) { return origRequestHandler.call(this, request, loadContext); diff --git a/packages/remix/src/utils/utils.ts b/packages/remix/src/utils/utils.ts index 5d1024dbc057..fed9e721e013 100644 --- a/packages/remix/src/utils/utils.ts +++ b/packages/remix/src/utils/utils.ts @@ -1,6 +1,6 @@ import type { DataFunctionArgs } from '@remix-run/node'; -import { logger } from '@sentry/core'; import type { Span, TransactionSource } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from './debug-build'; import { getRequestMatch, matchServerRoutes } from './vendor/response'; import type { ServerRoute, ServerRouteManifest } from './vendor/types'; diff --git a/packages/remix/src/utils/web-fetch.ts b/packages/remix/src/utils/web-fetch.ts new file mode 100644 index 000000000000..6e188bd9d440 --- /dev/null +++ b/packages/remix/src/utils/web-fetch.ts @@ -0,0 +1,180 @@ +// Based on Remix's implementation of Fetch API +// https://github.com/remix-run/web-std-io/blob/d2a003fe92096aaf97ab2a618b74875ccaadc280/packages/fetch/ +// The MIT License (MIT) + +// Copyright (c) 2016 - 2020 Node Fetch Team + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +import type { RemixRequest } from './vendor/types'; + +/* + * Symbol extractor utility to be able to access internal fields of Remix requests. + */ +const getInternalSymbols = ( + request: Record, +): { + bodyInternalsSymbol: string; + requestInternalsSymbol: string; +} => { + const symbols = Object.getOwnPropertySymbols(request); + return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + bodyInternalsSymbol: symbols.find(symbol => symbol.toString().includes('Body internals')) as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + requestInternalsSymbol: symbols.find(symbol => symbol.toString().includes('Request internals')) as any, + }; +}; + +/** + * Vendored from: + * https://github.com/remix-run/web-std-io/blob/f715b354c8c5b8edc550c5442dec5712705e25e7/packages/fetch/src/utils/get-search.js#L5 + */ +export const getSearch = (parsedURL: URL): string => { + if (parsedURL.search) { + return parsedURL.search; + } + + const lastOffset = parsedURL.href.length - 1; + const hash = parsedURL.hash || (parsedURL.href[lastOffset] === '#' ? '#' : ''); + return parsedURL.href[lastOffset - hash.length] === '?' ? '?' : ''; +}; + +/** + * Convert a Request to Node.js http request options. + * The options object to be passed to http.request + * Vendored / modified from: + * https://github.com/remix-run/web-std-io/blob/f715b354c8c5b8edc550c5442dec5712705e25e7/packages/fetch/src/request.js#L259 + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const normalizeRemixRequest = (request: RemixRequest): Record => { + const { requestInternalsSymbol, bodyInternalsSymbol } = getInternalSymbols(request); + + if (!requestInternalsSymbol && !request.headers) { + throw new Error('Could not find request headers'); + } + + const internalRequest = request[requestInternalsSymbol]; + + const parsedURL = internalRequest ? internalRequest.parsedURL : new URL(request.url); + const headers = internalRequest ? new Headers(internalRequest.headers) : request.headers; + + // Fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body === null && /^(post|put)$/i.test(request.method)) { + contentLengthValue = '0'; + } + + const internalBody = request[bodyInternalsSymbol]; + if (request.body !== null && internalBody) { + const totalBytes = internalBody.size; + // Set Content-Length if totalBytes is a number (that is not NaN) + if (typeof totalBytes === 'number' && !Number.isNaN(totalBytes)) { + contentLengthValue = String(totalBytes); + } + } + + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate,br'); + } + + let { agent } = request; + + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + if (!headers.has('Connection') && !agent) { + headers.set('Connection', 'close'); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + const search = getSearch(parsedURL); + + // Manually spread the URL object instead of spread syntax + const requestOptions = { + path: parsedURL.pathname + search, + pathname: parsedURL.pathname, + hostname: parsedURL.hostname, + protocol: parsedURL.protocol, + port: parsedURL.port, + hash: parsedURL.hash, + search: parsedURL.search, + // @ts-expect-error - it does not has a query + query: parsedURL.query, + href: parsedURL.href, + method: request.method, + headers: objectFromHeaders(headers), + insecureHTTPParser: request.insecureHTTPParser, + agent, + + // [SENTRY] For compatibility with Sentry SDK RequestData parser, adding `originalUrl` property. + originalUrl: parsedURL.href, + }; + + return requestOptions; +}; + +// This function is a `polyfill` for Object.fromEntries() +function objectFromHeaders(headers: Headers): Record { + const result: Record = {}; + let iterator: IterableIterator<[string, string]>; + + if (hasIterator(headers)) { + iterator = getIterator(headers) as IterableIterator<[string, string]>; + } else { + return {}; + } + + for (const [key, value] of iterator) { + result[key] = value; + } + return result; +} + +type IterableType = { + [Symbol.iterator]: () => Iterator; +}; + +function hasIterator(obj: T): obj is T & IterableType { + return obj !== null && typeof (obj as IterableType)[Symbol.iterator] === 'function'; +} + +function getIterator(obj: T): Iterator { + if (hasIterator(obj)) { + return (obj as IterableType)[Symbol.iterator](); + } + throw new Error('Object does not have an iterator'); +} diff --git a/packages/remix/test/integration/package.json b/packages/remix/test/integration/package.json index 552c26debdc9..4604b8c8b067 100644 --- a/packages/remix/test/integration/package.json +++ b/packages/remix/test/integration/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "remix build", "dev": "remix dev", - "start": "remix-serve build" + "start":"remix-serve build" }, "dependencies": { "@remix-run/express": "1.17.0", @@ -33,6 +33,7 @@ "@sentry-internal/replay-canvas": "file:../../../replay-canvas", "@sentry-internal/feedback": "file:../../../feedback", "@sentry/types": "file:../../../types", + "@sentry/utils": "file:../../../utils", "@vanilla-extract/css": "1.13.0", "@vanilla-extract/integration": "6.2.4", "@types/mime": "^3.0.0", diff --git a/packages/remix/test/integration/test/server/utils/helpers.ts b/packages/remix/test/integration/test/server/utils/helpers.ts index 61de1975972b..909d8d1671ae 100644 --- a/packages/remix/test/integration/test/server/utils/helpers.ts +++ b/packages/remix/test/integration/test/server/utils/helpers.ts @@ -2,10 +2,10 @@ import * as http from 'http'; import { AddressInfo } from 'net'; import * as path from 'path'; import { createRequestHandler } from '@remix-run/express'; -import { logger } from '@sentry/core'; /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import * as Sentry from '@sentry/node'; import type { EnvelopeItemType, Event, TransactionEvent } from '@sentry/types'; +import { logger } from '@sentry/utils'; import type { AxiosRequestConfig } from 'axios'; import axios from 'axios'; import express from 'express'; diff --git a/packages/remix/test/utils/normalizeRemixRequest.test.ts b/packages/remix/test/utils/normalizeRemixRequest.test.ts new file mode 100644 index 000000000000..64de88510014 --- /dev/null +++ b/packages/remix/test/utils/normalizeRemixRequest.test.ts @@ -0,0 +1,99 @@ +import type { RemixRequest } from '../../src/utils/vendor/types'; +import { normalizeRemixRequest } from '../../src/utils/web-fetch'; + +class Headers { + private _headers: Record = {}; + + constructor(headers?: Iterable<[string, string]>) { + if (headers) { + for (const [key, value] of headers) { + this.set(key, value); + } + } + } + static fromEntries(entries: Iterable<[string, string]>): Headers { + return new Headers(entries); + } + entries(): IterableIterator<[string, string]> { + return Object.entries(this._headers)[Symbol.iterator](); + } + + [Symbol.iterator](): IterableIterator<[string, string]> { + return this.entries(); + } + + get(key: string): string | null { + return this._headers[key] ?? null; + } + + has(key: string): boolean { + return this._headers[key] !== undefined; + } + + set(key: string, value: string): void { + this._headers[key] = value; + } +} + +class Request { + private _url: string; + private _options: { method: string; body?: any; headers: Headers }; + + constructor(url: string, options: { method: string; body?: any; headers: Headers }) { + this._url = url; + this._options = options; + } + + get method() { + return this._options.method; + } + + get url() { + return this._url; + } + + get headers() { + return this._options.headers; + } + + get body() { + return this._options.body; + } +} + +describe('normalizeRemixRequest', () => { + it('should normalize remix web-fetch request', () => { + const headers = new Headers(); + headers.set('Accept', 'text/html,application/json'); + headers.set('Cookie', 'name=value'); + const request = new Request('https://example.com/api/json?id=123', { + method: 'GET', + headers: headers as any, + }); + + const expected = { + agent: undefined, + hash: '', + headers: { + Accept: 'text/html,application/json', + Connection: 'close', + Cookie: 'name=value', + 'User-Agent': 'node-fetch', + }, + hostname: 'example.com', + href: 'https://example.com/api/json?id=123', + insecureHTTPParser: undefined, + method: 'GET', + originalUrl: 'https://example.com/api/json?id=123', + path: '/api/json?id=123', + pathname: '/api/json', + port: '', + protocol: 'https:', + query: undefined, + search: '?id=123', + }; + + const normalizedRequest = normalizeRemixRequest(request as unknown as RemixRequest); + expect(normalizedRequest).toEqual(expected); + }); +}); diff --git a/packages/replay-canvas/package.json b/packages/replay-canvas/package.json index 31f0844eb838..a1882f6e34af 100644 --- a/packages/replay-canvas/package.json +++ b/packages/replay-canvas/package.json @@ -70,7 +70,8 @@ "dependencies": { "@sentry-internal/replay": "8.39.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "engines": { "node": ">=14.18" diff --git a/packages/replay-internal/package.json b/packages/replay-internal/package.json index e56337e6c0f6..0837eb2c3461 100644 --- a/packages/replay-internal/package.json +++ b/packages/replay-internal/package.json @@ -52,7 +52,7 @@ "fix:eslint": "eslint . --format stylish --fix", "fix:biome": "biome check --apply .", "lint": "eslint . --format stylish", - "test": "vitest run", + "test": "vitest", "test:watch": "vitest --watch", "yalc:publish": "yalc publish --push --sig" }, @@ -78,7 +78,8 @@ "dependencies": { "@sentry-internal/browser-utils": "8.39.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "engines": { "node": ">=14.18" diff --git a/packages/replay-internal/src/constants.ts b/packages/replay-internal/src/constants.ts index da253a68ec8f..13ccea43df22 100644 --- a/packages/replay-internal/src/constants.ts +++ b/packages/replay-internal/src/constants.ts @@ -1,4 +1,4 @@ -import { GLOBAL_OBJ } from '@sentry/core'; +import { GLOBAL_OBJ } from '@sentry/utils'; // exporting a separate copy of `WINDOW` rather than exporting the one from `@sentry/browser` // prevents the browser package from being bundled in the CDN bundle, and avoids a diff --git a/packages/replay-internal/src/coreHandlers/handleBeforeSendEvent.ts b/packages/replay-internal/src/coreHandlers/handleBeforeSendEvent.ts index a6f2284e7db4..fb81b1fd88d0 100644 --- a/packages/replay-internal/src/coreHandlers/handleBeforeSendEvent.ts +++ b/packages/replay-internal/src/coreHandlers/handleBeforeSendEvent.ts @@ -1,5 +1,5 @@ -import { getLocationHref } from '@sentry/core'; import type { ErrorEvent, Event } from '@sentry/types'; +import { getLocationHref } from '@sentry/utils'; import type { ReplayContainer } from '../types'; import { createBreadcrumb } from '../util/createBreadcrumb'; diff --git a/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts b/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts index d521d3871a6c..034e5cdb05af 100644 --- a/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts +++ b/packages/replay-internal/src/coreHandlers/handleBreadcrumbs.ts @@ -1,6 +1,6 @@ import { getClient } from '@sentry/core'; -import { normalize } from '@sentry/core'; import type { Breadcrumb } from '@sentry/types'; +import { normalize } from '@sentry/utils'; import { CONSOLE_ARG_MAX_SIZE } from '../constants'; import type { ReplayContainer } from '../types'; diff --git a/packages/replay-internal/src/coreHandlers/handleDom.ts b/packages/replay-internal/src/coreHandlers/handleDom.ts index 168d9529ccb3..a5c20810481b 100644 --- a/packages/replay-internal/src/coreHandlers/handleDom.ts +++ b/packages/replay-internal/src/coreHandlers/handleDom.ts @@ -1,8 +1,8 @@ import { record } from '@sentry-internal/rrweb'; import type { serializedElementNodeWithId, serializedNodeWithId } from '@sentry-internal/rrweb-snapshot'; import { NodeType } from '@sentry-internal/rrweb-snapshot'; -import { htmlTreeAsString } from '@sentry/core'; import type { Breadcrumb, HandlerDataDom } from '@sentry/types'; +import { htmlTreeAsString } from '@sentry/utils'; import type { ReplayContainer } from '../types'; import { createBreadcrumb } from '../util/createBreadcrumb'; diff --git a/packages/replay-internal/src/coreHandlers/handleKeyboardEvent.ts b/packages/replay-internal/src/coreHandlers/handleKeyboardEvent.ts index 52ea76030ebd..0f7560f39584 100644 --- a/packages/replay-internal/src/coreHandlers/handleKeyboardEvent.ts +++ b/packages/replay-internal/src/coreHandlers/handleKeyboardEvent.ts @@ -1,5 +1,5 @@ -import { htmlTreeAsString } from '@sentry/core'; import type { Breadcrumb } from '@sentry/types'; +import { htmlTreeAsString } from '@sentry/utils'; import type { ReplayContainer } from '../types'; import { createBreadcrumb } from '../util/createBreadcrumb'; diff --git a/packages/replay-internal/src/coreHandlers/util/addBreadcrumbEvent.ts b/packages/replay-internal/src/coreHandlers/util/addBreadcrumbEvent.ts index d24f43bd5d4a..a324e5b24b25 100644 --- a/packages/replay-internal/src/coreHandlers/util/addBreadcrumbEvent.ts +++ b/packages/replay-internal/src/coreHandlers/util/addBreadcrumbEvent.ts @@ -1,6 +1,6 @@ import { EventType } from '@sentry-internal/rrweb'; -import { normalize } from '@sentry/core'; import type { Breadcrumb } from '@sentry/types'; +import { normalize } from '@sentry/utils'; import type { ReplayContainer } from '../../types'; diff --git a/packages/replay-internal/src/coreHandlers/util/networkUtils.ts b/packages/replay-internal/src/coreHandlers/util/networkUtils.ts index 22f98fc2bee7..2267fa502333 100644 --- a/packages/replay-internal/src/coreHandlers/util/networkUtils.ts +++ b/packages/replay-internal/src/coreHandlers/util/networkUtils.ts @@ -1,4 +1,4 @@ -import { dropUndefinedKeys, stringMatchesSomePattern } from '@sentry/core'; +import { dropUndefinedKeys, stringMatchesSomePattern } from '@sentry/utils'; import { NETWORK_BODY_MAX_SIZE, WINDOW } from '../../constants'; import { DEBUG_BUILD } from '../../debug-build'; diff --git a/packages/replay-internal/src/coreHandlers/util/onWindowOpen.ts b/packages/replay-internal/src/coreHandlers/util/onWindowOpen.ts index 4a305a53f501..e3b6b7ac92ed 100644 --- a/packages/replay-internal/src/coreHandlers/util/onWindowOpen.ts +++ b/packages/replay-internal/src/coreHandlers/util/onWindowOpen.ts @@ -1,4 +1,4 @@ -import { fill } from '@sentry/core'; +import { fill } from '@sentry/utils'; import { WINDOW } from '../../constants'; diff --git a/packages/replay-internal/src/integration.ts b/packages/replay-internal/src/integration.ts index 3c3f768b50df..1f690f9af88a 100644 --- a/packages/replay-internal/src/integration.ts +++ b/packages/replay-internal/src/integration.ts @@ -1,5 +1,4 @@ import { parseSampleRate } from '@sentry/core'; -import { consoleSandbox, dropUndefinedKeys, isBrowser } from '@sentry/core'; import type { BrowserClientReplayOptions, Client, @@ -7,6 +6,7 @@ import type { IntegrationFn, ReplayRecordingMode, } from '@sentry/types'; +import { consoleSandbox, dropUndefinedKeys, isBrowser } from '@sentry/utils'; import { DEFAULT_FLUSH_MAX_DELAY, diff --git a/packages/replay-internal/src/session/Session.ts b/packages/replay-internal/src/session/Session.ts index 93c1a2edd764..be2bcdac1506 100644 --- a/packages/replay-internal/src/session/Session.ts +++ b/packages/replay-internal/src/session/Session.ts @@ -1,4 +1,4 @@ -import { uuid4 } from '@sentry/core'; +import { uuid4 } from '@sentry/utils'; import type { Sampled, Session } from '../types'; diff --git a/packages/replay-internal/src/util/createPerformanceEntries.ts b/packages/replay-internal/src/util/createPerformanceEntries.ts index f4efad050750..c28e69caee00 100644 --- a/packages/replay-internal/src/util/createPerformanceEntries.ts +++ b/packages/replay-internal/src/util/createPerformanceEntries.ts @@ -1,5 +1,5 @@ import { record } from '@sentry-internal/rrweb'; -import { browserPerformanceTimeOrigin } from '@sentry/core'; +import { browserPerformanceTimeOrigin } from '@sentry/utils'; import { WINDOW } from '../constants'; import type { diff --git a/packages/replay-internal/src/util/createReplayEnvelope.ts b/packages/replay-internal/src/util/createReplayEnvelope.ts index 4f4376a0e501..de269fdf9905 100644 --- a/packages/replay-internal/src/util/createReplayEnvelope.ts +++ b/packages/replay-internal/src/util/createReplayEnvelope.ts @@ -1,5 +1,5 @@ -import { createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader } from '@sentry/core'; import type { DsnComponents, ReplayEnvelope, ReplayEvent, ReplayRecordingData } from '@sentry/types'; +import { createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader } from '@sentry/utils'; /** * Create a replay envelope ready to be sent. diff --git a/packages/replay-internal/src/util/logger.ts b/packages/replay-internal/src/util/logger.ts index 3cc98980ec7e..1b505f41703a 100644 --- a/packages/replay-internal/src/util/logger.ts +++ b/packages/replay-internal/src/util/logger.ts @@ -1,6 +1,6 @@ import { addBreadcrumb, captureException } from '@sentry/core'; -import { logger as coreLogger, severityLevelFromString } from '@sentry/core'; import type { ConsoleLevel, SeverityLevel } from '@sentry/types'; +import { logger as coreLogger, severityLevelFromString } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/replay-internal/src/util/sendReplayRequest.ts b/packages/replay-internal/src/util/sendReplayRequest.ts index 89c7740bc0b7..a623771af75b 100644 --- a/packages/replay-internal/src/util/sendReplayRequest.ts +++ b/packages/replay-internal/src/util/sendReplayRequest.ts @@ -1,8 +1,8 @@ import { getClient, getCurrentScope } from '@sentry/core'; -import type { RateLimits } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; -import { isRateLimited, updateRateLimits } from '@sentry/core'; import type { ReplayEvent, TransportMakeRequestResponse } from '@sentry/types'; +import type { RateLimits } from '@sentry/utils'; +import { resolvedSyncPromise } from '@sentry/utils'; +import { isRateLimited, updateRateLimits } from '@sentry/utils'; import { REPLAY_EVENT_NAME, UNABLE_TO_SEND_REPLAY } from '../constants'; import { DEBUG_BUILD } from '../debug-build'; diff --git a/packages/replay-internal/test.setup.ts b/packages/replay-internal/test.setup.ts index 17f7d5c9f2b7..05a762e60d50 100644 --- a/packages/replay-internal/test.setup.ts +++ b/packages/replay-internal/test.setup.ts @@ -4,8 +4,8 @@ import type { Mocked, MockedFunction } from 'vitest'; /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { getClient } from '@sentry/core'; -import * as SentryUtils from '@sentry/core'; import type { ReplayRecordingData, Transport } from '@sentry/types'; +import * as SentryUtils from '@sentry/utils'; import type { ReplayContainer, Session } from './src/types'; diff --git a/packages/replay-internal/test/integration/events.test.ts b/packages/replay-internal/test/integration/events.test.ts index 5a9813238628..a370fb730874 100644 --- a/packages/replay-internal/test/integration/events.test.ts +++ b/packages/replay-internal/test/integration/events.test.ts @@ -147,7 +147,7 @@ describe('Integration | events', () => { // when a tab has sat idle for a long period and user comes back to it. // // We pass a negative start time as it's a bit difficult to mock - // browserPerformanceTimeOrigin in `@sentry/core`. This would not happen in + // `@sentry/utils/browserPerformanceTimeOrigin`. This would not happen in // real world. replay.performanceEntries.push( PerformanceEntryResource({ diff --git a/packages/replay-internal/test/integration/flush.test.ts b/packages/replay-internal/test/integration/flush.test.ts index a56731cf85c3..72ef104d0633 100644 --- a/packages/replay-internal/test/integration/flush.test.ts +++ b/packages/replay-internal/test/integration/flush.test.ts @@ -10,7 +10,7 @@ import { useFakeTimers } from '../utils/use-fake-timers'; useFakeTimers(); import * as SentryBrowserUtils from '@sentry-internal/browser-utils'; -import * as SentryUtils from '@sentry/core'; +import * as SentryUtils from '@sentry/utils'; import { DEFAULT_FLUSH_MIN_DELAY, MAX_REPLAY_DURATION, WINDOW } from '../../src/constants'; import type { Replay } from '../../src/integration'; diff --git a/packages/replay-internal/test/mocks/resetSdkMock.ts b/packages/replay-internal/test/mocks/resetSdkMock.ts index 95e8d15375f2..ff2006b0604e 100644 --- a/packages/replay-internal/test/mocks/resetSdkMock.ts +++ b/packages/replay-internal/test/mocks/resetSdkMock.ts @@ -1,4 +1,4 @@ -import { resetInstrumentationHandlers } from '@sentry/core'; +import { resetInstrumentationHandlers } from '@sentry/utils'; import { vi } from 'vitest'; import type { Replay as ReplayIntegration } from '../../src/integration'; diff --git a/packages/replay-internal/test/unit/session/createSession.test.ts b/packages/replay-internal/test/unit/session/createSession.test.ts index 3f8cd4ce3ca7..0072741d6c07 100644 --- a/packages/replay-internal/test/unit/session/createSession.test.ts +++ b/packages/replay-internal/test/unit/session/createSession.test.ts @@ -14,9 +14,9 @@ import { saveSession } from '../../../src/session/saveSession'; vi.mock('./../../../src/session/saveSession'); -vi.mock('@sentry/core', async () => { +vi.mock('@sentry/utils', async () => { return { - ...((await vi.importActual('@sentry/core')) as { string: unknown }), + ...((await vi.importActual('@sentry/utils')) as { string: unknown }), uuid4: vi.fn(() => 'test_session_id'), }; }); diff --git a/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts b/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts index 41d76ad2d83c..7555625ecb7b 100644 --- a/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts +++ b/packages/replay-internal/test/unit/session/loadOrCreateSession.test.ts @@ -13,9 +13,9 @@ import { loadOrCreateSession } from '../../../src/session/loadOrCreateSession'; import { saveSession } from '../../../src/session/saveSession'; import type { SessionOptions } from '../../../src/types'; -vi.mock('@sentry/core', async () => { +vi.mock('@sentry/utils', async () => { return { - ...((await vi.importActual('@sentry/core')) as { string: unknown }), + ...((await vi.importActual('@sentry/utils')) as { string: unknown }), uuid4: vi.fn(() => 'test_session_uuid'), }; }); diff --git a/packages/replay-internal/test/unit/util/createPerformanceEntry.test.ts b/packages/replay-internal/test/unit/util/createPerformanceEntry.test.ts index 2e49ade50a26..b82a8941269d 100644 --- a/packages/replay-internal/test/unit/util/createPerformanceEntry.test.ts +++ b/packages/replay-internal/test/unit/util/createPerformanceEntry.test.ts @@ -5,8 +5,8 @@ import { useFakeTimers } from '../../utils/use-fake-timers'; useFakeTimers(); vi.setSystemTime(new Date('2023-01-01')); -vi.mock('@sentry/core', async () => ({ - ...(await vi.importActual('@sentry/core')), +vi.mock('@sentry/utils', async () => ({ + ...(await vi.importActual('@sentry/utils')), browserPerformanceTimeOrigin: new Date('2023-01-01').getTime(), })); diff --git a/packages/replay-internal/test/unit/util/createReplayEnvelope.test.ts b/packages/replay-internal/test/unit/util/createReplayEnvelope.test.ts index 6967f3f32a26..7b6977fd756a 100644 --- a/packages/replay-internal/test/unit/util/createReplayEnvelope.test.ts +++ b/packages/replay-internal/test/unit/util/createReplayEnvelope.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { makeDsn } from '@sentry/core'; import type { ReplayEvent } from '@sentry/types'; +import { makeDsn } from '@sentry/utils'; import { createReplayEnvelope } from '../../../src/util/createReplayEnvelope'; diff --git a/packages/replay-internal/test/unit/util/logger.test.ts b/packages/replay-internal/test/unit/util/logger.test.ts index 0d349b15ee62..075a6f27a841 100644 --- a/packages/replay-internal/test/unit/util/logger.test.ts +++ b/packages/replay-internal/test/unit/util/logger.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it } from 'vitest'; import * as SentryCore from '@sentry/core'; -import { logger as coreLogger } from '@sentry/core'; +import { logger as coreLogger } from '@sentry/utils'; import { logger } from '../../../src/util/logger'; const mockCaptureException = vi.spyOn(SentryCore, 'captureException'); diff --git a/packages/replay-internal/test/utils/TestClient.ts b/packages/replay-internal/test/utils/TestClient.ts index f534ac77c3c6..2651dfe1c91a 100644 --- a/packages/replay-internal/test/utils/TestClient.ts +++ b/packages/replay-internal/test/utils/TestClient.ts @@ -1,5 +1,4 @@ import { BaseClient, createTransport, initAndBind } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { BrowserClientReplayOptions, Client, @@ -8,6 +7,7 @@ import type { ParameterizedString, SeverityLevel, } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; export interface TestClientOptions extends ClientOptions, BrowserClientReplayOptions {} diff --git a/packages/solid/package.json b/packages/solid/package.json index 9c436c07985f..825c761586e8 100644 --- a/packages/solid/package.json +++ b/packages/solid/package.json @@ -46,7 +46,8 @@ "dependencies": { "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "peerDependencies": { "@solidjs/router": "^0.13.4", diff --git a/packages/solidstart/package.json b/packages/solidstart/package.json index 130ab9145b8d..e77d3f4be047 100644 --- a/packages/solidstart/package.json +++ b/packages/solidstart/package.json @@ -72,6 +72,7 @@ "@sentry/opentelemetry": "8.39.0", "@sentry/solid": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@sentry/vite-plugin": "2.22.6" }, "devDependencies": { diff --git a/packages/solidstart/src/server/index.ts b/packages/solidstart/src/server/index.ts index b2faa21768ba..54e0e8cf68ab 100644 --- a/packages/solidstart/src/server/index.ts +++ b/packages/solidstart/src/server/index.ts @@ -26,7 +26,6 @@ export { createGetModuleFromFilename, createTransport, cron, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, @@ -75,7 +74,6 @@ export { mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, NodeClient, nodeContextIntegration, @@ -93,7 +91,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, setContext, setCurrentClient, @@ -107,7 +104,6 @@ export { setupExpressErrorHandler, setupHapiErrorHandler, setupKoaErrorHandler, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, setUser, spanToBaggageHeader, diff --git a/packages/solidstart/src/server/middleware.ts b/packages/solidstart/src/server/middleware.ts index ad8ea9502b32..65287d23fa0b 100644 --- a/packages/solidstart/src/server/middleware.ts +++ b/packages/solidstart/src/server/middleware.ts @@ -1,5 +1,5 @@ import { getTraceMetaTags } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; +import { addNonEnumerableProperty } from '@sentry/utils'; import type { ResponseMiddleware } from '@solidjs/start/middleware'; import type { FetchEvent } from '@solidjs/start/server'; diff --git a/packages/solidstart/src/server/utils.ts b/packages/solidstart/src/server/utils.ts index 90bf9b426a93..f570ae355424 100644 --- a/packages/solidstart/src/server/utils.ts +++ b/packages/solidstart/src/server/utils.ts @@ -1,6 +1,6 @@ -import { logger } from '@sentry/core'; import { flush, getGlobalScope } from '@sentry/node'; import type { EventProcessor, Options } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../common/debug-build'; /** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */ diff --git a/packages/svelte/package.json b/packages/svelte/package.json index c568955313b5..426524570670 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -42,6 +42,7 @@ "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "magic-string": "^0.30.0" }, "peerDependencies": { diff --git a/packages/svelte/src/sdk.ts b/packages/svelte/src/sdk.ts index 29a3379a5140..aa40e5a25a98 100644 --- a/packages/svelte/src/sdk.ts +++ b/packages/svelte/src/sdk.ts @@ -1,8 +1,8 @@ import type { BrowserOptions } from '@sentry/browser'; import { addEventProcessor, init as browserInit } from '@sentry/browser'; import { applySdkMetadata } from '@sentry/core'; -import { getDomElement } from '@sentry/core'; import type { Client, EventProcessor } from '@sentry/types'; +import { getDomElement } from '@sentry/utils'; /** * Inits the Svelte SDK */ diff --git a/packages/sveltekit/package.json b/packages/sveltekit/package.json index c1a018561b68..0fcf4479885c 100644 --- a/packages/sveltekit/package.json +++ b/packages/sveltekit/package.json @@ -45,6 +45,7 @@ "@sentry/opentelemetry": "8.39.0", "@sentry/svelte": "8.39.0", "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0", "@sentry/vite-plugin": "2.22.6", "magic-string": "0.30.7", "magicast": "0.2.8", diff --git a/packages/sveltekit/src/client/browserTracingIntegration.ts b/packages/sveltekit/src/client/browserTracingIntegration.ts index f41de176b073..d2a266e2cbea 100644 --- a/packages/sveltekit/src/client/browserTracingIntegration.ts +++ b/packages/sveltekit/src/client/browserTracingIntegration.ts @@ -1,6 +1,5 @@ import { navigating, page } from '$app/stores'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core'; -import { dropUndefinedKeys } from '@sentry/core'; import { WINDOW, browserTracingIntegration as originalBrowserTracingIntegration, @@ -10,6 +9,7 @@ import { startInactiveSpan, } from '@sentry/svelte'; import type { Client, Integration, Span } from '@sentry/types'; +import { dropUndefinedKeys } from '@sentry/utils'; /** * A custom `BrowserTracing` integration for SvelteKit. diff --git a/packages/sveltekit/src/client/handleError.ts b/packages/sveltekit/src/client/handleError.ts index 447acce45e60..0880d93a59ef 100644 --- a/packages/sveltekit/src/client/handleError.ts +++ b/packages/sveltekit/src/client/handleError.ts @@ -1,5 +1,5 @@ -import { consoleSandbox } from '@sentry/core'; import { captureException } from '@sentry/svelte'; +import { consoleSandbox } from '@sentry/utils'; import type { HandleClientError } from '@sveltejs/kit'; // The SvelteKit default error handler just logs the error to the console diff --git a/packages/sveltekit/src/client/load.ts b/packages/sveltekit/src/client/load.ts index 185495ae412f..6f0e84ef140f 100644 --- a/packages/sveltekit/src/client/load.ts +++ b/packages/sveltekit/src/client/load.ts @@ -4,8 +4,8 @@ import { handleCallbackErrors, startSpan, } from '@sentry/core'; -import { addNonEnumerableProperty, objectify } from '@sentry/core'; import { captureException } from '@sentry/svelte'; +import { addNonEnumerableProperty, objectify } from '@sentry/utils'; import type { LoadEvent } from '@sveltejs/kit'; import type { SentryWrappedFlag } from '../common/utils'; diff --git a/packages/sveltekit/src/server/handle.ts b/packages/sveltekit/src/server/handle.ts index 2b7f32e0876a..cee8520400c1 100644 --- a/packages/sveltekit/src/server/handle.ts +++ b/packages/sveltekit/src/server/handle.ts @@ -10,9 +10,9 @@ import { withIsolationScope, } from '@sentry/core'; import { startSpan } from '@sentry/core'; -import { logger, winterCGRequestToRequestData } from '@sentry/core'; import { continueTrace } from '@sentry/node'; import type { Span } from '@sentry/types'; +import { logger, winterCGRequestToRequestData } from '@sentry/utils'; import type { Handle, ResolveOptions } from '@sveltejs/kit'; import { DEBUG_BUILD } from '../common/debug-build'; @@ -131,9 +131,7 @@ export function sentryHandle(handlerOptions?: SentryHandleOptions): Handle { return withIsolationScope(isolationScope => { // We only call continueTrace in the initial top level request to avoid // creating a new root span for the sub request. - isolationScope.setSDKProcessingMetadata({ - normalizedRequest: winterCGRequestToRequestData(input.event.request.clone()), - }); + isolationScope.setSDKProcessingMetadata({ request: winterCGRequestToRequestData(input.event.request.clone()) }); return continueTrace(getTracePropagationData(input.event), () => instrumentHandle(input, options)); }); }; @@ -169,9 +167,7 @@ async function instrumentHandle( name: routeName, }, async (span?: Span) => { - getCurrentScope().setSDKProcessingMetadata({ - normalizedRequest: winterCGRequestToRequestData(event.request.clone()), - }); + getCurrentScope().setSDKProcessingMetadata({ request: winterCGRequestToRequestData(event.request.clone()) }); const res = await resolve(event, { transformPageChunk: addSentryCodeToPage(options), }); diff --git a/packages/sveltekit/src/server/handleError.ts b/packages/sveltekit/src/server/handleError.ts index 7f6a8cd0b0cb..f61251245c4d 100644 --- a/packages/sveltekit/src/server/handleError.ts +++ b/packages/sveltekit/src/server/handleError.ts @@ -1,5 +1,5 @@ -import { consoleSandbox } from '@sentry/core'; import { captureException } from '@sentry/node'; +import { consoleSandbox } from '@sentry/utils'; import type { HandleServerError } from '@sveltejs/kit'; import { flushIfServerless } from './utils'; diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index c954d4b1bf78..05f105c252a8 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -26,7 +26,6 @@ export { createGetModuleFromFilename, createTransport, cron, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, DEFAULT_USER_INCLUDES, @@ -77,7 +76,6 @@ export { mysql2Integration, mysqlIntegration, nativeNodeFetchIntegration, - // eslint-disable-next-line deprecation/deprecation nestIntegration, NodeClient, nodeContextIntegration, @@ -95,7 +93,6 @@ export { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, - // eslint-disable-next-line deprecation/deprecation sessionTimingIntegration, setContext, setCurrentClient, @@ -109,7 +106,6 @@ export { setupExpressErrorHandler, setupHapiErrorHandler, setupKoaErrorHandler, - // eslint-disable-next-line deprecation/deprecation setupNestErrorHandler, setUser, spanToBaggageHeader, diff --git a/packages/sveltekit/src/server/load.ts b/packages/sveltekit/src/server/load.ts index c4a67eaf3482..82a8c548c6ec 100644 --- a/packages/sveltekit/src/server/load.ts +++ b/packages/sveltekit/src/server/load.ts @@ -1,5 +1,5 @@ -import { addNonEnumerableProperty } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan } from '@sentry/node'; +import { addNonEnumerableProperty } from '@sentry/utils'; import type { LoadEvent, ServerLoadEvent } from '@sveltejs/kit'; import type { SentryWrappedFlag } from '../common/utils'; diff --git a/packages/sveltekit/src/server/rewriteFramesIntegration.ts b/packages/sveltekit/src/server/rewriteFramesIntegration.ts index c01e248f937c..da37457cc5b9 100644 --- a/packages/sveltekit/src/server/rewriteFramesIntegration.ts +++ b/packages/sveltekit/src/server/rewriteFramesIntegration.ts @@ -1,6 +1,6 @@ import { defineIntegration, rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/core'; -import { GLOBAL_OBJ, basename, escapeStringForRegex, join } from '@sentry/core'; import type { IntegrationFn, StackFrame } from '@sentry/types'; +import { GLOBAL_OBJ, basename, escapeStringForRegex, join } from '@sentry/utils'; import { WRAPPED_MODULE_SUFFIX } from '../vite/autoInstrument'; import type { GlobalWithSentryValues } from '../vite/injectGlobalValues'; diff --git a/packages/sveltekit/src/server/serverRoute.ts b/packages/sveltekit/src/server/serverRoute.ts index dbf930ce1180..bd8f57a6578a 100644 --- a/packages/sveltekit/src/server/serverRoute.ts +++ b/packages/sveltekit/src/server/serverRoute.ts @@ -1,5 +1,5 @@ -import { addNonEnumerableProperty } from '@sentry/core'; import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, startSpan } from '@sentry/node'; +import { addNonEnumerableProperty } from '@sentry/utils'; import type { RequestEvent } from '@sveltejs/kit'; import { flushIfServerless, sendErrorToSentry } from './utils'; diff --git a/packages/sveltekit/src/server/utils.ts b/packages/sveltekit/src/server/utils.ts index 8eae93d531ab..8d7f2c649331 100644 --- a/packages/sveltekit/src/server/utils.ts +++ b/packages/sveltekit/src/server/utils.ts @@ -1,5 +1,5 @@ -import { logger, objectify } from '@sentry/core'; import { captureException, flush } from '@sentry/node'; +import { logger, objectify } from '@sentry/utils'; import type { RequestEvent } from '@sveltejs/kit'; import { DEBUG_BUILD } from '../common/debug-build'; diff --git a/packages/sveltekit/src/vite/injectGlobalValues.ts b/packages/sveltekit/src/vite/injectGlobalValues.ts index 96ad05123ce6..8a14a004dd84 100644 --- a/packages/sveltekit/src/vite/injectGlobalValues.ts +++ b/packages/sveltekit/src/vite/injectGlobalValues.ts @@ -1,4 +1,4 @@ -import type { InternalGlobal } from '@sentry/core'; +import type { InternalGlobal } from '@sentry/utils'; export type GlobalSentryValues = { __sentry_sveltekit_output_dir?: string; diff --git a/packages/sveltekit/src/vite/sentryVitePlugins.ts b/packages/sveltekit/src/vite/sentryVitePlugins.ts index 60258f653400..7482eee7e610 100644 --- a/packages/sveltekit/src/vite/sentryVitePlugins.ts +++ b/packages/sveltekit/src/vite/sentryVitePlugins.ts @@ -1,4 +1,4 @@ -import { dropUndefinedKeys } from '@sentry/core'; +import { dropUndefinedKeys } from '@sentry/utils'; import type { Plugin } from 'vite'; import type { AutoInstrumentSelection } from './autoInstrument'; import { makeAutoInstrumentationPlugin } from './autoInstrument'; diff --git a/packages/sveltekit/src/vite/sourceMaps.ts b/packages/sveltekit/src/vite/sourceMaps.ts index 9a5656f3f78f..d0faf85addbd 100644 --- a/packages/sveltekit/src/vite/sourceMaps.ts +++ b/packages/sveltekit/src/vite/sourceMaps.ts @@ -1,8 +1,8 @@ import * as child_process from 'child_process'; import * as fs from 'fs'; import * as path from 'path'; -import { escapeStringForRegex, uuid4 } from '@sentry/core'; import { getSentryRelease } from '@sentry/node'; +import { escapeStringForRegex, uuid4 } from '@sentry/utils'; import type { SentryVitePluginOptions } from '@sentry/vite-plugin'; import { sentryVitePlugin } from '@sentry/vite-plugin'; import type { Plugin } from 'vite'; diff --git a/packages/sveltekit/test/server/rewriteFramesIntegration.ts b/packages/sveltekit/test/server/rewriteFramesIntegration.ts index ab0306876e20..acf4591d8371 100644 --- a/packages/sveltekit/test/server/rewriteFramesIntegration.ts +++ b/packages/sveltekit/test/server/rewriteFramesIntegration.ts @@ -1,6 +1,6 @@ import { rewriteFramesIntegration } from '@sentry/browser'; -import { basename } from '@sentry/core'; import type { Event, StackFrame } from '@sentry/types'; +import { basename } from '@sentry/utils'; import { rewriteFramesIteratee } from '../../src/server/rewriteFramesIntegration'; import type { GlobalWithSentryValues } from '../../src/vite/injectGlobalValues'; diff --git a/packages/sveltekit/test/utils.ts b/packages/sveltekit/test/utils.ts index a4e0299b396d..540db2882373 100644 --- a/packages/sveltekit/test/utils.ts +++ b/packages/sveltekit/test/utils.ts @@ -1,6 +1,6 @@ import { createTransport } from '@sentry/core'; -import { resolvedSyncPromise } from '@sentry/core'; import type { ClientOptions } from '@sentry/types'; +import { resolvedSyncPromise } from '@sentry/utils'; export function getDefaultNodeClientOptions(options: Partial = {}): ClientOptions { return { diff --git a/packages/types/src/scope.ts b/packages/types/src/scope.ts index d2c33bf0b720..2d5c72230aef 100644 --- a/packages/types/src/scope.ts +++ b/packages/types/src/scope.ts @@ -217,9 +217,7 @@ export interface Scope { clearAttachments(): this; /** - * Add data which will be accessible during event processing but won't get sent to Sentry. - * - * TODO(v9): We should type this stricter, so that e.g. `normalizedRequest` is strictly typed. + * Add data which will be accessible during event processing but won't get sent to Sentry */ setSDKProcessingMetadata(newData: { [key: string]: unknown }): this; diff --git a/packages/types/src/severity.ts b/packages/types/src/severity.ts index 8a59bef56f30..78d1a6f5dd73 100644 --- a/packages/types/src/severity.ts +++ b/packages/types/src/severity.ts @@ -1,3 +1,3 @@ -// Note: If this is ever changed, the `validSeverityLevels` array in `@sentry/core` needs to be changed, also. (See +// Note: If this is ever changed, the `validSeverityLevels` array in `@sentry/utils` needs to be changed, also. (See // note there for why we can't derive one from the other.) export type SeverityLevel = 'fatal' | 'error' | 'warning' | 'log' | 'info' | 'debug'; diff --git a/packages/utils/jest.config.js b/packages/utils/jest.config.js new file mode 100644 index 000000000000..f9b7ccfa4502 --- /dev/null +++ b/packages/utils/jest.config.js @@ -0,0 +1,9 @@ +const baseConfig = require('../../jest/jest.config.js'); + +module.exports = { + ...baseConfig, + transform: { + '^.+\\.ts$': 'ts-jest', + '^.+\\.js$': 'ts-jest', + }, +}; diff --git a/packages/utils/package.json b/packages/utils/package.json index d3079f9fddf6..a4e6f1540d4f 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -39,13 +39,16 @@ "access": "public" }, "dependencies": { - "@sentry/types": "8.39.0", - "@sentry/core": "8.39.0" + "@sentry/types": "8.39.0" + }, + "devDependencies": { + "@types/array.prototype.flat": "^1.2.1", + "array.prototype.flat": "^1.3.0" }, "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", - "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:transpile": "yarn ts-node scripts/buildRollup.ts", "build:types": "run-s build:types:core build:types:downlevel", "build:types:core": "tsc -p tsconfig.types.json", "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", @@ -58,6 +61,8 @@ "clean": "rimraf build coverage cjs esm sentry-utils-*.tgz", "fix": "eslint . --format stylish --fix", "lint": "eslint . --format stylish", + "test": "jest", + "test:watch": "jest --watch", "yalc:publish": "yalc publish --push --sig" }, "volta": { diff --git a/packages/utils/rollup.npm.config.mjs b/packages/utils/rollup.npm.config.mjs index 4f4e949d4950..cc3ad4064820 100644 --- a/packages/utils/rollup.npm.config.mjs +++ b/packages/utils/rollup.npm.config.mjs @@ -1,6 +1,19 @@ // @ts-check + +import { readFileSync } from 'fs'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; +import replace from '@rollup/plugin-replace'; import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; +const packageJson = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf-8')); + +if (!packageJson.version) { + throw new Error('invariant: package version not found'); +} + +const packageVersion = packageJson.version; + export default makeNPMConfigVariants( makeBaseNPMConfig({ packageSpecificConfig: { @@ -13,6 +26,14 @@ export default makeNPMConfigVariants( ? true : Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES), }, + plugins: [ + replace({ + preventAssignment: true, + values: { + __SENTRY_SDK_VERSION__: JSON.stringify(packageVersion), + }, + }), + ], }, }), ); diff --git a/packages/utils/scripts/buildRollup.ts b/packages/utils/scripts/buildRollup.ts new file mode 100644 index 000000000000..2e7486f7d005 --- /dev/null +++ b/packages/utils/scripts/buildRollup.ts @@ -0,0 +1,16 @@ +import * as childProcess from 'child_process'; +import * as fs from 'fs'; + +/** + * Run the given shell command, piping the shell process's `stdin`, `stdout`, and `stderr` to that of the current + * process. Returns contents of `stdout`. + */ +function run(cmd: string, options?: childProcess.ExecSyncOptions): string | Buffer { + return childProcess.execSync(cmd, { stdio: 'inherit', ...options }); +} + +run('yarn rollup -c rollup.npm.config.mjs'); + +// We want to distribute the README because it contains the MIT license blurb from Sucrase and Rollup +fs.copyFileSync('src/buildPolyfills/README.md', 'build/cjs/build-polyfills-license.md'); +fs.copyFileSync('src/buildPolyfills/README.md', 'build/esm/build-polyfills-license.md'); diff --git a/packages/core/src/utils-hoist/aggregate-errors.ts b/packages/utils/src/aggregate-errors.ts similarity index 100% rename from packages/core/src/utils-hoist/aggregate-errors.ts rename to packages/utils/src/aggregate-errors.ts diff --git a/packages/core/src/utils-hoist/anr.ts b/packages/utils/src/anr.ts similarity index 100% rename from packages/core/src/utils-hoist/anr.ts rename to packages/utils/src/anr.ts diff --git a/packages/core/src/utils-hoist/array.ts b/packages/utils/src/array.ts similarity index 100% rename from packages/core/src/utils-hoist/array.ts rename to packages/utils/src/array.ts diff --git a/packages/core/src/utils-hoist/baggage.ts b/packages/utils/src/baggage.ts similarity index 100% rename from packages/core/src/utils-hoist/baggage.ts rename to packages/utils/src/baggage.ts diff --git a/packages/core/src/utils-hoist/breadcrumb-log-level.ts b/packages/utils/src/breadcrumb-log-level.ts similarity index 100% rename from packages/core/src/utils-hoist/breadcrumb-log-level.ts rename to packages/utils/src/breadcrumb-log-level.ts diff --git a/packages/core/src/utils-hoist/browser.ts b/packages/utils/src/browser.ts similarity index 100% rename from packages/core/src/utils-hoist/browser.ts rename to packages/utils/src/browser.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/README.md b/packages/utils/src/buildPolyfills/README.md similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/README.md rename to packages/utils/src/buildPolyfills/README.md diff --git a/packages/core/src/utils-hoist/buildPolyfills/_asyncNullishCoalesce.ts b/packages/utils/src/buildPolyfills/_asyncNullishCoalesce.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/_asyncNullishCoalesce.ts rename to packages/utils/src/buildPolyfills/_asyncNullishCoalesce.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/_asyncOptionalChain.ts b/packages/utils/src/buildPolyfills/_asyncOptionalChain.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/_asyncOptionalChain.ts rename to packages/utils/src/buildPolyfills/_asyncOptionalChain.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/_asyncOptionalChainDelete.ts b/packages/utils/src/buildPolyfills/_asyncOptionalChainDelete.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/_asyncOptionalChainDelete.ts rename to packages/utils/src/buildPolyfills/_asyncOptionalChainDelete.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/_nullishCoalesce.ts b/packages/utils/src/buildPolyfills/_nullishCoalesce.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/_nullishCoalesce.ts rename to packages/utils/src/buildPolyfills/_nullishCoalesce.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/_optionalChain.ts b/packages/utils/src/buildPolyfills/_optionalChain.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/_optionalChain.ts rename to packages/utils/src/buildPolyfills/_optionalChain.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/_optionalChainDelete.ts b/packages/utils/src/buildPolyfills/_optionalChainDelete.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/_optionalChainDelete.ts rename to packages/utils/src/buildPolyfills/_optionalChainDelete.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/index.ts b/packages/utils/src/buildPolyfills/index.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/index.ts rename to packages/utils/src/buildPolyfills/index.ts diff --git a/packages/core/src/utils-hoist/buildPolyfills/types.ts b/packages/utils/src/buildPolyfills/types.ts similarity index 100% rename from packages/core/src/utils-hoist/buildPolyfills/types.ts rename to packages/utils/src/buildPolyfills/types.ts diff --git a/packages/core/src/utils-hoist/cache.ts b/packages/utils/src/cache.ts similarity index 100% rename from packages/core/src/utils-hoist/cache.ts rename to packages/utils/src/cache.ts diff --git a/packages/core/src/utils-hoist/clientreport.ts b/packages/utils/src/clientreport.ts similarity index 100% rename from packages/core/src/utils-hoist/clientreport.ts rename to packages/utils/src/clientreport.ts diff --git a/packages/core/src/utils-hoist/cookie.ts b/packages/utils/src/cookie.ts similarity index 100% rename from packages/core/src/utils-hoist/cookie.ts rename to packages/utils/src/cookie.ts diff --git a/packages/core/src/utils-hoist/debug-build.ts b/packages/utils/src/debug-build.ts similarity index 100% rename from packages/core/src/utils-hoist/debug-build.ts rename to packages/utils/src/debug-build.ts diff --git a/packages/core/src/utils-hoist/debug-ids.ts b/packages/utils/src/debug-ids.ts similarity index 100% rename from packages/core/src/utils-hoist/debug-ids.ts rename to packages/utils/src/debug-ids.ts diff --git a/packages/core/src/utils-hoist/dsn.ts b/packages/utils/src/dsn.ts similarity index 100% rename from packages/core/src/utils-hoist/dsn.ts rename to packages/utils/src/dsn.ts diff --git a/packages/core/src/utils-hoist/env.ts b/packages/utils/src/env.ts similarity index 100% rename from packages/core/src/utils-hoist/env.ts rename to packages/utils/src/env.ts diff --git a/packages/core/src/utils-hoist/envelope.ts b/packages/utils/src/envelope.ts similarity index 100% rename from packages/core/src/utils-hoist/envelope.ts rename to packages/utils/src/envelope.ts diff --git a/packages/core/src/utils-hoist/error.ts b/packages/utils/src/error.ts similarity index 100% rename from packages/core/src/utils-hoist/error.ts rename to packages/utils/src/error.ts diff --git a/packages/core/src/utils-hoist/eventbuilder.ts b/packages/utils/src/eventbuilder.ts similarity index 100% rename from packages/core/src/utils-hoist/eventbuilder.ts rename to packages/utils/src/eventbuilder.ts diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 0b4bcd669706..e60bc3bec409 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -1,21 +1,22 @@ +export { applyAggregateErrorsToEvent } from './aggregate-errors'; +export { flatten } from './array'; +export { getBreadcrumbLogLevelFromHttpStatusCode } from './breadcrumb-log-level'; +export { getComponentName, getDomElement, getLocationHref, htmlTreeAsString } from './browser'; +export { dsnFromString, dsnToString, makeDsn } from './dsn'; +export { SentryError } from './error'; +export { GLOBAL_OBJ, getGlobalSingleton } from './worldwide'; +export type { InternalGlobal } from './worldwide'; +export { addConsoleInstrumentationHandler } from './instrument/console'; +export { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './instrument/fetch'; +export { addGlobalErrorInstrumentationHandler } from './instrument/globalError'; +export { addGlobalUnhandledRejectionInstrumentationHandler } from './instrument/globalUnhandledRejection'; export { - applyAggregateErrorsToEvent, - getBreadcrumbLogLevelFromHttpStatusCode, - dsnFromString, - dsnToString, - makeDsn, - SentryError, - GLOBAL_OBJ, - getGlobalSingleton, - addConsoleInstrumentationHandler, - addFetchEndInstrumentationHandler, - addFetchInstrumentationHandler, - addGlobalErrorInstrumentationHandler, - addGlobalUnhandledRejectionInstrumentationHandler, addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers, +} from './instrument/handlers'; +export { isDOMError, isDOMException, isElement, @@ -31,20 +32,23 @@ export { isSyntheticEvent, isThenable, isVueViewModel, - isBrowser, - CONSOLE_LEVELS, - consoleSandbox, - logger, - originalConsoleMethods, +} from './is'; +export { isBrowser } from './isBrowser'; +export { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods } from './logger'; +export { memoBuilder } from './memo'; +export { addContextToFrame, addExceptionMechanism, addExceptionTypeValue, + arrayify, checkOrSetAlreadyCaught, getEventDescription, parseSemver, uuid4, - normalize, - normalizeToSize, +} from './misc'; +export { dynamicRequire, isNodeEnv, loadModule } from './node'; +export { normalize, normalizeToSize, normalizeUrlToBase } from './normalize'; +export { addNonEnumerableProperty, convertToPlainObject, dropUndefinedKeys, @@ -53,43 +57,66 @@ export { getOriginalFunction, markFunctionWrapped, objectify, - makePromiseBuffer, + urlEncode, +} from './object'; +export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path'; +export { makePromiseBuffer } from './promisebuffer'; +export type { PromiseBuffer } from './promisebuffer'; + +// TODO: Remove requestdata export once equivalent integration is used everywhere +export { + DEFAULT_USER_INCLUDES, addNormalizedRequestDataToEvent, + addRequestDataToEvent, + // eslint-disable-next-line deprecation/deprecation + extractPathForTransaction, + extractRequestData, winterCGHeadersToDict, winterCGRequestToRequestData, - severityLevelFromString, - validSeverityLevels, +} from './requestdata'; +export type { + AddRequestDataToEventOptions, + // eslint-disable-next-line deprecation/deprecation + TransactionNamingScheme, +} from './requestdata'; + +export { severityLevelFromString, validSeverityLevels } from './severity'; +export { UNKNOWN_FUNCTION, createStackParser, getFramesFromEvent, getFunctionName, stackParserFromStackParserOptions, stripSentryFramesAndReverse, - filenameIsInApp, - node, - nodeStackLineParser, - isMatchingPattern, - safeJoin, - snipLine, - stringMatchesSomePattern, - truncate, - SyncPromise, - rejectedSyncPromise, - resolvedSyncPromise, +} from './stacktrace'; +export { filenameIsInApp, node, nodeStackLineParser } from './node-stack-trace'; +export { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate } from './string'; +export { + isNativeFunction, + supportsDOMError, + supportsDOMException, + supportsErrorEvent, + supportsFetch, + supportsNativeFetch, + supportsReferrerPolicy, + supportsReportingObserver, +} from './supports'; +export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise'; +export { + _browserPerformanceTimeOriginMode, + browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, +} from './time'; +export { TRACEPARENT_REGEXP, extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders, - getSDKSource, - isBrowserBundle, - MAX_BAGGAGE_STRING_LENGTH, - SENTRY_BAGGAGE_KEY_PREFIX, - SENTRY_BAGGAGE_KEY_PREFIX_REGEX, - baggageHeaderToDynamicSamplingContext, - dynamicSamplingContextToSentryBaggageHeader, - parseBaggageHeader, +} from './tracing'; +export { getSDKSource, isBrowserBundle } from './env'; +export type { SdkSource } from './env'; +export { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, @@ -101,437 +128,41 @@ export { getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope, - createClientReportEnvelope, +} from './envelope'; +export { createClientReportEnvelope } from './clientreport'; +export { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits, - eventFromMessage, - eventFromUnknownInput, - exceptionFromError, - parseStackFrames, - callFrameToStackFrame, - watchdogTimer, - LRUMap, - generatePropagationContext, - vercelWaitUntil, - SDK_VERSION, - getDebugImagesForResources, - getFilenameToDebugIdMap, - escapeStringForRegex, - basename, - dirname, - isAbsolute, - join, - normalizePath, - relative, - resolve, - getComponentName, - getDomElement, - getLocationHref, - htmlTreeAsString, - isNativeFunction, - supportsDOMError, - supportsDOMException, - supportsErrorEvent, - supportsFetch, - supportsNativeFetch, - supportsReferrerPolicy, - supportsReportingObserver, - _browserPerformanceTimeOriginMode, - browserPerformanceTimeOrigin, - supportsHistory, - dynamicRequire, - isNodeEnv, - loadModule, - flatten, - memoBuilder, - arrayify, - normalizeUrlToBase, - urlEncode, - // eslint-disable-next-line deprecation/deprecation - extractPathForTransaction, - DEFAULT_USER_INCLUDES, - extractRequestData, - addRequestDataToEvent, - _asyncNullishCoalesce, - _asyncOptionalChain, - _asyncOptionalChainDelete, - _nullishCoalesce, - _optionalChain, - _optionalChainDelete, +} from './ratelimit'; +export type { RateLimits } from './ratelimit'; +export { BAGGAGE_HEADER_NAME, - getNumberOfUrlSegments, - getSanitizedUrlString, - parseUrl, - stripUrlQueryAndFragment, - makeFifoCache, -} from '@sentry/core'; - -export type { - InternalGlobal, - PromiseBuffer, - RateLimits, - AddRequestDataToEventOptions, - SdkSource, - // eslint-disable-next-line deprecation/deprecation - TransactionNamingScheme, -} from '@sentry/core'; - -// TODO(v9/lforst): Uncomment below to add deprecation notices - -// import { -// applyAggregateErrorsToEvent as applyAggregateErrorsToEvent_imported, -// getBreadcrumbLogLevelFromHttpStatusCode as getBreadcrumbLogLevelFromHttpStatusCode_imported, -// dsnFromString as dsnFromString_imported, -// dsnToString as dsnToString_imported, -// makeDsn as makeDsn_imported, -// SentryError as SentryError_imported, -// GLOBAL_OBJ as GLOBAL_OBJ_imported, -// getGlobalSingleton as getGlobalSingleton_imported, -// addConsoleInstrumentationHandler as addConsoleInstrumentationHandler_imported, -// addFetchEndInstrumentationHandler as addFetchEndInstrumentationHandler_imported, -// addFetchInstrumentationHandler as addFetchInstrumentationHandler_imported, -// addGlobalErrorInstrumentationHandler as addGlobalErrorInstrumentationHandler_imported, -// addGlobalUnhandledRejectionInstrumentationHandler as addGlobalUnhandledRejectionInstrumentationHandler_imported, -// addHandler as addHandler_imported, -// maybeInstrument as maybeInstrument_imported, -// resetInstrumentationHandlers as resetInstrumentationHandlers_imported, -// triggerHandlers as triggerHandlers_imported, -// isDOMError as isDOMError_imported, -// isDOMException as isDOMException_imported, -// isElement as isElement_imported, -// isError as isError_imported, -// isErrorEvent as isErrorEvent_imported, -// isEvent as isEvent_imported, -// isInstanceOf as isInstanceOf_imported, -// isParameterizedString as isParameterizedString_imported, -// isPlainObject as isPlainObject_imported, -// isPrimitive as isPrimitive_imported, -// isRegExp as isRegExp_imported, -// isString as isString_imported, -// isSyntheticEvent as isSyntheticEvent_imported, -// isThenable as isThenable_imported, -// isVueViewModel as isVueViewModel_imported, -// isBrowser as isBrowser_imported, -// CONSOLE_LEVELS as CONSOLE_LEVELS_imported, -// consoleSandbox as consoleSandbox_imported, -// logger as logger_imported, -// originalConsoleMethods as originalConsoleMethods_imported, -// addContextToFrame as addContextToFrame_imported, -// addExceptionMechanism as addExceptionMechanism_imported, -// addExceptionTypeValue as addExceptionTypeValue_imported, -// checkOrSetAlreadyCaught as checkOrSetAlreadyCaught_imported, -// getEventDescription as getEventDescription_imported, -// parseSemver as parseSemver_imported, -// uuid4 as uuid4_imported, -// normalize as normalize_imported, -// normalizeToSize as normalizeToSize_imported, -// addNonEnumerableProperty as addNonEnumerableProperty_imported, -// convertToPlainObject as convertToPlainObject_imported, -// dropUndefinedKeys as dropUndefinedKeys_imported, -// extractExceptionKeysForMessage as extractExceptionKeysForMessage_imported, -// fill as fill_imported, -// getOriginalFunction as getOriginalFunction_imported, -// markFunctionWrapped as markFunctionWrapped_imported, -// objectify as objectify_imported, -// makePromiseBuffer as makePromiseBuffer_imported, -// addNormalizedRequestDataToEvent as addNormalizedRequestDataToEvent_imported, -// winterCGHeadersToDict as winterCGHeadersToDict_imported, -// winterCGRequestToRequestData as winterCGRequestToRequestData_imported, -// severityLevelFromString as severityLevelFromString_imported, -// validSeverityLevels as validSeverityLevels_imported, -// UNKNOWN_FUNCTION as UNKNOWN_FUNCTION_imported, -// createStackParser as createStackParser_imported, -// getFramesFromEvent as getFramesFromEvent_imported, -// getFunctionName as getFunctionName_imported, -// stackParserFromStackParserOptions as stackParserFromStackParserOptions_imported, -// stripSentryFramesAndReverse as stripSentryFramesAndReverse_imported, -// filenameIsInApp as filenameIsInApp_imported, -// node as node_imported, -// nodeStackLineParser as nodeStackLineParser_imported, -// isMatchingPattern as isMatchingPattern_imported, -// safeJoin as safeJoin_imported, -// snipLine as snipLine_imported, -// stringMatchesSomePattern as stringMatchesSomePattern_imported, -// truncate as truncate_imported, -// SyncPromise as SyncPromise_imported, -// rejectedSyncPromise as rejectedSyncPromise_imported, -// resolvedSyncPromise as resolvedSyncPromise_imported, -// dateTimestampInSeconds as dateTimestampInSeconds_imported, -// timestampInSeconds as timestampInSeconds_imported, -// TRACEPARENT_REGEXP as TRACEPARENT_REGEXP_imported, -// extractTraceparentData as extractTraceparentData_imported, -// generateSentryTraceHeader as generateSentryTraceHeader_imported, -// propagationContextFromHeaders as propagationContextFromHeaders_imported, -// getSDKSource as getSDKSource_imported, -// isBrowserBundle as isBrowserBundle_imported, -// MAX_BAGGAGE_STRING_LENGTH as MAX_BAGGAGE_STRING_LENGTH_imported, -// SENTRY_BAGGAGE_KEY_PREFIX as SENTRY_BAGGAGE_KEY_PREFIX_imported, -// SENTRY_BAGGAGE_KEY_PREFIX_REGEX as SENTRY_BAGGAGE_KEY_PREFIX_REGEX_imported, -// baggageHeaderToDynamicSamplingContext as baggageHeaderToDynamicSamplingContext_imported, -// dynamicSamplingContextToSentryBaggageHeader as dynamicSamplingContextToSentryBaggageHeader_imported, -// parseBaggageHeader as parseBaggageHeader_imported, -// addItemToEnvelope as addItemToEnvelope_imported, -// createAttachmentEnvelopeItem as createAttachmentEnvelopeItem_imported, -// createEnvelope as createEnvelope_imported, -// createEventEnvelopeHeaders as createEventEnvelopeHeaders_imported, -// createSpanEnvelopeItem as createSpanEnvelopeItem_imported, -// envelopeContainsItemType as envelopeContainsItemType_imported, -// envelopeItemTypeToDataCategory as envelopeItemTypeToDataCategory_imported, -// forEachEnvelopeItem as forEachEnvelopeItem_imported, -// getSdkMetadataForEnvelopeHeader as getSdkMetadataForEnvelopeHeader_imported, -// parseEnvelope as parseEnvelope_imported, -// serializeEnvelope as serializeEnvelope_imported, -// createClientReportEnvelope as createClientReportEnvelope_imported, -// DEFAULT_RETRY_AFTER as DEFAULT_RETRY_AFTER_imported, -// disabledUntil as disabledUntil_imported, -// isRateLimited as isRateLimited_imported, -// parseRetryAfterHeader as parseRetryAfterHeader_imported, -// updateRateLimits as updateRateLimits_imported, -// eventFromMessage as eventFromMessage_imported, -// eventFromUnknownInput as eventFromUnknownInput_imported, -// exceptionFromError as exceptionFromError_imported, -// parseStackFrames as parseStackFrames_imported, -// callFrameToStackFrame as callFrameToStackFrame_imported, -// watchdogTimer as watchdogTimer_imported, -// LRUMap as LRUMap_imported, -// generatePropagationContext as generatePropagationContext_imported, -// vercelWaitUntil as vercelWaitUntil_imported, -// SDK_VERSION as SDK_VERSION_imported, -// getDebugImagesForResources as getDebugImagesForResources_imported, -// getFilenameToDebugIdMap as getFilenameToDebugIdMap_imported, -// escapeStringForRegex as escapeStringForRegex_imported, -// basename as basename_imported, -// dirname as dirname_imported, -// isAbsolute as isAbsolute_imported, -// join as join_imported, -// normalizePath as normalizePath_imported, -// relative as relative_imported, -// resolve as resolve_imported, -// getComponentName as getComponentName_imported, -// getDomElement as getDomElement_imported, -// getLocationHref as getLocationHref_imported, -// htmlTreeAsString as htmlTreeAsString_imported, -// isNativeFunction as isNativeFunction_imported, -// supportsDOMError as supportsDOMError_imported, -// supportsDOMException as supportsDOMException_imported, -// supportsErrorEvent as supportsErrorEvent_imported, -// supportsFetch as supportsFetch_imported, -// supportsNativeFetch as supportsNativeFetch_imported, -// supportsReferrerPolicy as supportsReferrerPolicy_imported, -// supportsReportingObserver as supportsReportingObserver_imported, -// _browserPerformanceTimeOriginMode as _browserPerformanceTimeOriginMode_imported, -// browserPerformanceTimeOrigin as browserPerformanceTimeOrigin_imported, -// supportsHistory as supportsHistory_imported, -// dynamicRequire as dynamicRequire_imported, -// isNodeEnv as isNodeEnv_imported, -// loadModule as loadModule_imported, -// flatten as flatten_imported, -// memoBuilder as memoBuilder_imported, -// arrayify as arrayify_imported, -// normalizeUrlToBase as normalizeUrlToBase_imported, -// urlEncode as urlEncode_imported, -// extractPathForTransaction as extractPathForTransaction_imported, -// DEFAULT_USER_INCLUDES as DEFAULT_USER_INCLUDES_imported, -// extractRequestData as extractRequestData_imported, -// addRequestDataToEvent as addRequestDataToEvent_imported, -// _asyncNullishCoalesce as _asyncNullishCoalesce_imported, -// _asyncOptionalChain as _asyncOptionalChain_imported, -// _asyncOptionalChainDelete as _asyncOptionalChainDelete_imported, -// _nullishCoalesce as _nullishCoalesce_imported, -// _optionalChain as _optionalChain_imported, -// _optionalChainDelete as _optionalChainDelete_imported, -// BAGGAGE_HEADER_NAME as BAGGAGE_HEADER_NAME_imported, -// getNumberOfUrlSegments as getNumberOfUrlSegments_imported, -// getSanitizedUrlString as getSanitizedUrlString_imported, -// parseUrl as parseUrl_imported, -// stripUrlQueryAndFragment as stripUrlQueryAndFragment_imported, -// makeFifoCache as makeFifoCache_imported, -// } from '@sentry/core'; - -// export const applyAggregateErrorsToEvent = applyAggregateErrorsToEvent_imported; -// export const getBreadcrumbLogLevelFromHttpStatusCode = getBreadcrumbLogLevelFromHttpStatusCode_imported; -// export const dsnFromString = dsnFromString_imported; -// export const dsnToString = dsnToString_imported; -// export const makeDsn = makeDsn_imported; -// export const SentryError = SentryError_imported; -// export const GLOBAL_OBJ = GLOBAL_OBJ_imported; -// export const getGlobalSingleton = getGlobalSingleton_imported; -// export const addConsoleInstrumentationHandler = addConsoleInstrumentationHandler_imported; -// export const addFetchEndInstrumentationHandler = addFetchEndInstrumentationHandler_imported; -// export const addFetchInstrumentationHandler = addFetchInstrumentationHandler_imported; -// export const addGlobalErrorInstrumentationHandler = addGlobalErrorInstrumentationHandler_imported; -// export const addGlobalUnhandledRejectionInstrumentationHandler = -// addGlobalUnhandledRejectionInstrumentationHandler_imported; -// export const addHandler = addHandler_imported; -// export const maybeInstrument = maybeInstrument_imported; -// export const resetInstrumentationHandlers = resetInstrumentationHandlers_imported; -// export const triggerHandlers = triggerHandlers_imported; -// export const isDOMError = isDOMError_imported; -// export const isDOMException = isDOMException_imported; -// export const isElement = isElement_imported; -// export const isError = isError_imported; -// export const isErrorEvent = isErrorEvent_imported; -// export const isEvent = isEvent_imported; -// export const isInstanceOf = isInstanceOf_imported; -// export const isParameterizedString = isParameterizedString_imported; -// export const isPlainObject = isPlainObject_imported; -// export const isPrimitive = isPrimitive_imported; -// export const isRegExp = isRegExp_imported; -// export const isString = isString_imported; -// export const isSyntheticEvent = isSyntheticEvent_imported; -// export const isThenable = isThenable_imported; -// export const isVueViewModel = isVueViewModel_imported; -// export const isBrowser = isBrowser_imported; -// export const CONSOLE_LEVELS = CONSOLE_LEVELS_imported; -// export const consoleSandbox = consoleSandbox_imported; -// export const logger = logger_imported; -// export const originalConsoleMethods = originalConsoleMethods_imported; -// export const addContextToFrame = addContextToFrame_imported; -// export const addExceptionMechanism = addExceptionMechanism_imported; -// export const addExceptionTypeValue = addExceptionTypeValue_imported; -// export const checkOrSetAlreadyCaught = checkOrSetAlreadyCaught_imported; -// export const getEventDescription = getEventDescription_imported; -// export const parseSemver = parseSemver_imported; -// export const uuid4 = uuid4_imported; -// export const normalize = normalize_imported; -// export const normalizeToSize = normalizeToSize_imported; -// export const addNonEnumerableProperty = addNonEnumerableProperty_imported; -// export const convertToPlainObject = convertToPlainObject_imported; -// export const dropUndefinedKeys = dropUndefinedKeys_imported; -// export const extractExceptionKeysForMessage = extractExceptionKeysForMessage_imported; -// export const fill = fill_imported; -// export const getOriginalFunction = getOriginalFunction_imported; -// export const markFunctionWrapped = markFunctionWrapped_imported; -// export const objectify = objectify_imported; -// export const makePromiseBuffer = makePromiseBuffer_imported; -// export const addNormalizedRequestDataToEvent = addNormalizedRequestDataToEvent_imported; -// export const winterCGHeadersToDict = winterCGHeadersToDict_imported; -// export const winterCGRequestToRequestData = winterCGRequestToRequestData_imported; -// export const severityLevelFromString = severityLevelFromString_imported; -// export const validSeverityLevels = validSeverityLevels_imported; -// export const UNKNOWN_FUNCTION = UNKNOWN_FUNCTION_imported; -// export const createStackParser = createStackParser_imported; -// export const getFramesFromEvent = getFramesFromEvent_imported; -// export const getFunctionName = getFunctionName_imported; -// export const stackParserFromStackParserOptions = stackParserFromStackParserOptions_imported; -// export const stripSentryFramesAndReverse = stripSentryFramesAndReverse_imported; -// export const filenameIsInApp = filenameIsInApp_imported; -// export const node = node_imported; -// export const nodeStackLineParser = nodeStackLineParser_imported; -// export const isMatchingPattern = isMatchingPattern_imported; -// export const safeJoin = safeJoin_imported; -// export const snipLine = snipLine_imported; -// export const stringMatchesSomePattern = stringMatchesSomePattern_imported; -// export const truncate = truncate_imported; -// export const SyncPromise = SyncPromise_imported; -// export const rejectedSyncPromise = rejectedSyncPromise_imported; -// export const resolvedSyncPromise = resolvedSyncPromise_imported; -// export const dateTimestampInSeconds = dateTimestampInSeconds_imported; -// export const timestampInSeconds = timestampInSeconds_imported; -// export const TRACEPARENT_REGEXP = TRACEPARENT_REGEXP_imported; -// export const extractTraceparentData = extractTraceparentData_imported; -// export const generateSentryTraceHeader = generateSentryTraceHeader_imported; -// export const propagationContextFromHeaders = propagationContextFromHeaders_imported; -// export const getSDKSource = getSDKSource_imported; -// export const isBrowserBundle = isBrowserBundle_imported; -// export const MAX_BAGGAGE_STRING_LENGTH = MAX_BAGGAGE_STRING_LENGTH_imported; -// export const SENTRY_BAGGAGE_KEY_PREFIX = SENTRY_BAGGAGE_KEY_PREFIX_imported; -// export const SENTRY_BAGGAGE_KEY_PREFIX_REGEX = SENTRY_BAGGAGE_KEY_PREFIX_REGEX_imported; -// export const baggageHeaderToDynamicSamplingContext = baggageHeaderToDynamicSamplingContext_imported; -// export const dynamicSamplingContextToSentryBaggageHeader = dynamicSamplingContextToSentryBaggageHeader_imported; -// export const parseBaggageHeader = parseBaggageHeader_imported; -// export const addItemToEnvelope = addItemToEnvelope_imported; -// export const createAttachmentEnvelopeItem = createAttachmentEnvelopeItem_imported; -// export const createEnvelope = createEnvelope_imported; -// export const createEventEnvelopeHeaders = createEventEnvelopeHeaders_imported; -// export const createSpanEnvelopeItem = createSpanEnvelopeItem_imported; -// export const envelopeContainsItemType = envelopeContainsItemType_imported; -// export const envelopeItemTypeToDataCategory = envelopeItemTypeToDataCategory_imported; -// export const forEachEnvelopeItem = forEachEnvelopeItem_imported; -// export const getSdkMetadataForEnvelopeHeader = getSdkMetadataForEnvelopeHeader_imported; -// export const parseEnvelope = parseEnvelope_imported; -// export const serializeEnvelope = serializeEnvelope_imported; -// export const createClientReportEnvelope = createClientReportEnvelope_imported; -// export const DEFAULT_RETRY_AFTER = DEFAULT_RETRY_AFTER_imported; -// export const disabledUntil = disabledUntil_imported; -// export const isRateLimited = isRateLimited_imported; -// export const parseRetryAfterHeader = parseRetryAfterHeader_imported; -// export const updateRateLimits = updateRateLimits_imported; -// export const eventFromMessage = eventFromMessage_imported; -// export const eventFromUnknownInput = eventFromUnknownInput_imported; -// export const exceptionFromError = exceptionFromError_imported; -// export const parseStackFrames = parseStackFrames_imported; -// export const callFrameToStackFrame = callFrameToStackFrame_imported; -// export const watchdogTimer = watchdogTimer_imported; -// export const LRUMap = LRUMap_imported; -// export const generatePropagationContext = generatePropagationContext_imported; -// export const vercelWaitUntil = vercelWaitUntil_imported; -// export const SDK_VERSION = SDK_VERSION_imported; -// export const getDebugImagesForResources = getDebugImagesForResources_imported; -// export const getFilenameToDebugIdMap = getFilenameToDebugIdMap_imported; -// export const escapeStringForRegex = escapeStringForRegex_imported; -// export const basename = basename_imported; -// export const dirname = dirname_imported; -// export const isAbsolute = isAbsolute_imported; -// export const join = join_imported; -// export const normalizePath = normalizePath_imported; -// export const relative = relative_imported; -// export const resolve = resolve_imported; -// export const getComponentName = getComponentName_imported; -// export const getDomElement = getDomElement_imported; -// export const getLocationHref = getLocationHref_imported; -// export const htmlTreeAsString = htmlTreeAsString_imported; -// export const isNativeFunction = isNativeFunction_imported; -// export const supportsDOMError = supportsDOMError_imported; -// export const supportsDOMException = supportsDOMException_imported; -// export const supportsErrorEvent = supportsErrorEvent_imported; -// export const supportsFetch = supportsFetch_imported; -// export const supportsNativeFetch = supportsNativeFetch_imported; -// export const supportsReferrerPolicy = supportsReferrerPolicy_imported; -// export const supportsReportingObserver = supportsReportingObserver_imported; -// export const _browserPerformanceTimeOriginMode = _browserPerformanceTimeOriginMode_imported; -// export const browserPerformanceTimeOrigin = browserPerformanceTimeOrigin_imported; -// export const supportsHistory = supportsHistory_imported; -// export const dynamicRequire = dynamicRequire_imported; -// export const isNodeEnv = isNodeEnv_imported; -// export const loadModule = loadModule_imported; -// export const flatten = flatten_imported; -// export const memoBuilder = memoBuilder_imported; -// export const arrayify = arrayify_imported; -// export const normalizeUrlToBase = normalizeUrlToBase_imported; -// export const urlEncode = urlEncode_imported; -// export const extractPathForTransaction = extractPathForTransaction_imported; -// export const DEFAULT_USER_INCLUDES = DEFAULT_USER_INCLUDES_imported; -// export const extractRequestData = extractRequestData_imported; -// export const addRequestDataToEvent = addRequestDataToEvent_imported; -// export const _asyncNullishCoalesce = _asyncNullishCoalesce_imported; -// export const _asyncOptionalChain = _asyncOptionalChain_imported; -// export const _asyncOptionalChainDelete = _asyncOptionalChainDelete_imported; -// export const _nullishCoalesce = _nullishCoalesce_imported; -// export const _optionalChain = _optionalChain_imported; -// export const _optionalChainDelete = _optionalChainDelete_imported; -// export const BAGGAGE_HEADER_NAME = BAGGAGE_HEADER_NAME_imported; -// export const getNumberOfUrlSegments = getNumberOfUrlSegments_imported; -// export const getSanitizedUrlString = getSanitizedUrlString_imported; -// export const parseUrl = parseUrl_imported; -// export const stripUrlQueryAndFragment = stripUrlQueryAndFragment_imported; -// export const makeFifoCache = makeFifoCache_imported; + MAX_BAGGAGE_STRING_LENGTH, + SENTRY_BAGGAGE_KEY_PREFIX, + SENTRY_BAGGAGE_KEY_PREFIX_REGEX, + baggageHeaderToDynamicSamplingContext, + dynamicSamplingContextToSentryBaggageHeader, + parseBaggageHeader, +} from './baggage'; -// import type { -// InternalGlobal as InternalGlobal_imported, -// PromiseBuffer as PromiseBuffer_imported, -// RateLimits as RateLimits_imported, -// AddRequestDataToEventOptions as AddRequestDataToEventOptions_imported, -// SdkSource as SdkSource_imported, -// TransactionNamingScheme as TransactionNamingScheme_imported, -// } from '@sentry/core'; +export { getNumberOfUrlSegments, getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from './url'; +export { makeFifoCache } from './cache'; +export { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames } from './eventbuilder'; +export { callFrameToStackFrame, watchdogTimer } from './anr'; +export { LRUMap } from './lru'; +export { generatePropagationContext } from './propagationContext'; +export { vercelWaitUntil } from './vercelWaitUntil'; +export { SDK_VERSION } from './version'; +export { getDebugImagesForResources, getFilenameToDebugIdMap } from './debug-ids'; +export { escapeStringForRegex } from './vendor/escapeStringForRegex'; +export { supportsHistory } from './vendor/supportsHistory'; -// export type InternalGlobal = InternalGlobal_imported; -// export type SdkSource = SdkSource_imported; -// export type RateLimits = RateLimits_imported; -// export type AddRequestDataToEventOptions = AddRequestDataToEventOptions_imported; -// export type PromiseBuffer = PromiseBuffer_imported; -// export type TransactionNamingScheme = TransactionNamingScheme_imported; +export { _asyncNullishCoalesce } from './buildPolyfills/_asyncNullishCoalesce'; +export { _asyncOptionalChain } from './buildPolyfills/_asyncOptionalChain'; +export { _asyncOptionalChainDelete } from './buildPolyfills/_asyncOptionalChainDelete'; +export { _nullishCoalesce } from './buildPolyfills/_nullishCoalesce'; +export { _optionalChain } from './buildPolyfills/_optionalChain'; +export { _optionalChainDelete } from './buildPolyfills/_optionalChainDelete'; diff --git a/packages/core/src/utils-hoist/instrument/console.ts b/packages/utils/src/instrument/console.ts similarity index 100% rename from packages/core/src/utils-hoist/instrument/console.ts rename to packages/utils/src/instrument/console.ts diff --git a/packages/core/src/utils-hoist/instrument/fetch.ts b/packages/utils/src/instrument/fetch.ts similarity index 100% rename from packages/core/src/utils-hoist/instrument/fetch.ts rename to packages/utils/src/instrument/fetch.ts diff --git a/packages/core/src/utils-hoist/instrument/globalError.ts b/packages/utils/src/instrument/globalError.ts similarity index 100% rename from packages/core/src/utils-hoist/instrument/globalError.ts rename to packages/utils/src/instrument/globalError.ts diff --git a/packages/core/src/utils-hoist/instrument/globalUnhandledRejection.ts b/packages/utils/src/instrument/globalUnhandledRejection.ts similarity index 100% rename from packages/core/src/utils-hoist/instrument/globalUnhandledRejection.ts rename to packages/utils/src/instrument/globalUnhandledRejection.ts diff --git a/packages/core/src/utils-hoist/instrument/handlers.ts b/packages/utils/src/instrument/handlers.ts similarity index 100% rename from packages/core/src/utils-hoist/instrument/handlers.ts rename to packages/utils/src/instrument/handlers.ts diff --git a/packages/utils/src/instrument/index.ts b/packages/utils/src/instrument/index.ts new file mode 100644 index 000000000000..8a83959c636b --- /dev/null +++ b/packages/utils/src/instrument/index.ts @@ -0,0 +1,18 @@ +import { addConsoleInstrumentationHandler } from './console'; +import { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler } from './fetch'; +import { addGlobalErrorInstrumentationHandler } from './globalError'; +import { addGlobalUnhandledRejectionInstrumentationHandler } from './globalUnhandledRejection'; +import { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers } from './handlers'; + +export { + addConsoleInstrumentationHandler, + addFetchInstrumentationHandler, + addGlobalErrorInstrumentationHandler, + addGlobalUnhandledRejectionInstrumentationHandler, + addHandler, + maybeInstrument, + triggerHandlers, + // Only exported for tests + resetInstrumentationHandlers, + addFetchEndInstrumentationHandler, +}; diff --git a/packages/core/src/utils-hoist/is.ts b/packages/utils/src/is.ts similarity index 100% rename from packages/core/src/utils-hoist/is.ts rename to packages/utils/src/is.ts diff --git a/packages/core/src/utils-hoist/isBrowser.ts b/packages/utils/src/isBrowser.ts similarity index 100% rename from packages/core/src/utils-hoist/isBrowser.ts rename to packages/utils/src/isBrowser.ts diff --git a/packages/core/src/utils-hoist/logger.ts b/packages/utils/src/logger.ts similarity index 98% rename from packages/core/src/utils-hoist/logger.ts rename to packages/utils/src/logger.ts index c56dc2fff699..533b59fd5882 100644 --- a/packages/core/src/utils-hoist/logger.ts +++ b/packages/utils/src/logger.ts @@ -26,7 +26,7 @@ export const originalConsoleMethods: { } = {}; /** JSDoc */ -export interface Logger extends LoggerConsoleMethods { +interface Logger extends LoggerConsoleMethods { disable(): void; enable(): void; isEnabled(): boolean; diff --git a/packages/core/src/utils-hoist/lru.ts b/packages/utils/src/lru.ts similarity index 100% rename from packages/core/src/utils-hoist/lru.ts rename to packages/utils/src/lru.ts diff --git a/packages/core/src/utils-hoist/memo.ts b/packages/utils/src/memo.ts similarity index 100% rename from packages/core/src/utils-hoist/memo.ts rename to packages/utils/src/memo.ts diff --git a/packages/core/src/utils-hoist/misc.ts b/packages/utils/src/misc.ts similarity index 100% rename from packages/core/src/utils-hoist/misc.ts rename to packages/utils/src/misc.ts diff --git a/packages/core/src/utils-hoist/node-stack-trace.ts b/packages/utils/src/node-stack-trace.ts similarity index 97% rename from packages/core/src/utils-hoist/node-stack-trace.ts rename to packages/utils/src/node-stack-trace.ts index fc96fccc8847..7748046528a4 100644 --- a/packages/core/src/utils-hoist/node-stack-trace.ts +++ b/packages/utils/src/node-stack-trace.ts @@ -135,7 +135,7 @@ export function node(getModule?: GetModuleFn): StackLineParserFn { /** * Node.js stack line parser * - * This is in @sentry/core so it can be used from the Electron SDK in the browser for when `nodeIntegration == true`. + * This is in @sentry/utils so it can be used from the Electron SDK in the browser for when `nodeIntegration == true`. * This allows it to be used without referencing or importing any node specific code which causes bundlers to complain */ export function nodeStackLineParser(getModule?: GetModuleFn): StackLineParser { diff --git a/packages/core/src/utils-hoist/node.ts b/packages/utils/src/node.ts similarity index 100% rename from packages/core/src/utils-hoist/node.ts rename to packages/utils/src/node.ts diff --git a/packages/core/src/utils-hoist/normalize.ts b/packages/utils/src/normalize.ts similarity index 100% rename from packages/core/src/utils-hoist/normalize.ts rename to packages/utils/src/normalize.ts diff --git a/packages/core/src/utils-hoist/object.ts b/packages/utils/src/object.ts similarity index 98% rename from packages/core/src/utils-hoist/object.ts rename to packages/utils/src/object.ts index 13ddff35664b..e0424f6aa120 100644 --- a/packages/core/src/utils-hoist/object.ts +++ b/packages/utils/src/object.ts @@ -32,11 +32,7 @@ export function fill(source: { [key: string]: any }, name: string, replacementFa markFunctionWrapped(wrapped, original); } - try { - source[name] = wrapped; - } catch { - DEBUG_BUILD && logger.log(`Failed to replace method "${name}" in object`, source); - } + source[name] = wrapped; } /** diff --git a/packages/core/src/utils-hoist/path.ts b/packages/utils/src/path.ts similarity index 100% rename from packages/core/src/utils-hoist/path.ts rename to packages/utils/src/path.ts diff --git a/packages/core/src/utils-hoist/promisebuffer.ts b/packages/utils/src/promisebuffer.ts similarity index 100% rename from packages/core/src/utils-hoist/promisebuffer.ts rename to packages/utils/src/promisebuffer.ts diff --git a/packages/core/src/utils-hoist/propagationContext.ts b/packages/utils/src/propagationContext.ts similarity index 100% rename from packages/core/src/utils-hoist/propagationContext.ts rename to packages/utils/src/propagationContext.ts diff --git a/packages/core/src/utils-hoist/ratelimit.ts b/packages/utils/src/ratelimit.ts similarity index 100% rename from packages/core/src/utils-hoist/ratelimit.ts rename to packages/utils/src/ratelimit.ts diff --git a/packages/core/src/utils-hoist/requestdata.ts b/packages/utils/src/requestdata.ts similarity index 85% rename from packages/core/src/utils-hoist/requestdata.ts rename to packages/utils/src/requestdata.ts index 5a40c1fa5945..13ec367addda 100644 --- a/packages/core/src/utils-hoist/requestdata.ts +++ b/packages/utils/src/requestdata.ts @@ -14,7 +14,6 @@ import { DEBUG_BUILD } from './debug-build'; import { isPlainObject, isString } from './is'; import { logger } from './logger'; import { normalize } from './normalize'; -import { dropUndefinedKeys } from './object'; import { truncate } from './string'; import { stripUrlQueryAndFragment } from './url'; import { getClientIPAddress, ipHeaderNames } from './vendor/getIpAddress'; @@ -417,95 +416,18 @@ export function winterCGHeadersToDict(winterCGHeaders: WebFetchHeaders): Record< return headers; } -/** - * Convert common request headers to a simple dictionary. - */ -export function headersToDict(reqHeaders: Record): Record { - const headers: Record = Object.create(null); - - try { - Object.entries(reqHeaders).forEach(([key, value]) => { - if (typeof value === 'string') { - headers[key] = value; - } - }); - } catch (e) { - DEBUG_BUILD && - logger.warn('Sentry failed extracting headers from a request object. If you see this, please file an issue.'); - } - - return headers; -} - /** * Converts a `Request` object that implements the `Web Fetch API` (https://developer.mozilla.org/en-US/docs/Web/API/Headers) into the format that the `RequestData` integration understands. */ -export function winterCGRequestToRequestData(req: WebFetchRequest): RequestEventData { +export function winterCGRequestToRequestData(req: WebFetchRequest): PolymorphicRequest { const headers = winterCGHeadersToDict(req.headers); - return { method: req.method, url: req.url, - query_string: extractQueryParamsFromUrl(req.url), headers, - // TODO: Can we extract body data from the request? }; } -/** - * Convert a HTTP request object to RequestEventData to be passed as normalizedRequest. - * Instead of allowing `PolymorphicRequest` to be passed, - * we want to be more specific and generally require a http.IncomingMessage-like object. - */ -export function httpRequestToRequestData(request: { - method?: string; - url?: string; - headers?: { - [key: string]: string | string[] | undefined; - }; - protocol?: string; - socket?: unknown; -}): RequestEventData { - const headers = request.headers || {}; - const host = headers.host || ''; - const protocol = request.socket && (request.socket as { encrypted?: boolean }).encrypted ? 'https' : 'http'; - const originalUrl = request.url || ''; - const absoluteUrl = originalUrl.startsWith(protocol) ? originalUrl : `${protocol}://${host}${originalUrl}`; - - // This is non-standard, but may be sometimes set - // It may be overwritten later by our own body handling - const data = (request as PolymorphicRequest).body || undefined; - - // This is non-standard, but may be set on e.g. Next.js or Express requests - const cookies = (request as PolymorphicRequest).cookies; - - return dropUndefinedKeys({ - url: absoluteUrl, - method: request.method, - query_string: extractQueryParamsFromUrl(originalUrl), - headers: headersToDict(headers), - cookies, - data, - }); -} - -/** Extract the query params from an URL. */ -export function extractQueryParamsFromUrl(url: string): string | undefined { - // url is path and query string - if (!url) { - return; - } - - try { - // The `URL` constructor can't handle internal URLs of the form `/some/path/here`, so stick a dummy protocol and - // hostname as the base. Since the point here is just to grab the query string, it doesn't matter what we use. - const queryParams = new URL(url, 'http://dogs.are.great').search.slice(1); - return queryParams.length ? queryParams : undefined; - } catch { - return undefined; - } -} - function extractNormalizedRequestData( normalizedRequest: RequestEventData, { include }: { include: string[] }, diff --git a/packages/core/src/utils-hoist/severity.ts b/packages/utils/src/severity.ts similarity index 91% rename from packages/core/src/utils-hoist/severity.ts rename to packages/utils/src/severity.ts index c19c047c90bf..983ec1ae08ae 100644 --- a/packages/core/src/utils-hoist/severity.ts +++ b/packages/utils/src/severity.ts @@ -6,8 +6,8 @@ import type { SeverityLevel } from '@sentry/types'; // b) moving the`SeverityLevel` type here, or // c) importing `validSeverityLevels` from here into `@sentry/types`. // -// Option A would make `@sentry/types` a runtime dependency of `@sentry/core` (not good), and options B and C would -// create a circular dependency between `@sentry/types` and `@sentry/core` (also not good). So a TODO accompanying the +// Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would +// create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the // type, reminding anyone who changes it to change this list also, will have to do. export const validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug']; diff --git a/packages/core/src/utils-hoist/stacktrace.ts b/packages/utils/src/stacktrace.ts similarity index 100% rename from packages/core/src/utils-hoist/stacktrace.ts rename to packages/utils/src/stacktrace.ts diff --git a/packages/core/src/utils-hoist/string.ts b/packages/utils/src/string.ts similarity index 100% rename from packages/core/src/utils-hoist/string.ts rename to packages/utils/src/string.ts diff --git a/packages/core/src/utils-hoist/supports.ts b/packages/utils/src/supports.ts similarity index 100% rename from packages/core/src/utils-hoist/supports.ts rename to packages/utils/src/supports.ts diff --git a/packages/core/src/utils-hoist/syncpromise.ts b/packages/utils/src/syncpromise.ts similarity index 100% rename from packages/core/src/utils-hoist/syncpromise.ts rename to packages/utils/src/syncpromise.ts diff --git a/packages/core/src/utils-hoist/time.ts b/packages/utils/src/time.ts similarity index 100% rename from packages/core/src/utils-hoist/time.ts rename to packages/utils/src/time.ts diff --git a/packages/core/src/utils-hoist/tracing.ts b/packages/utils/src/tracing.ts similarity index 100% rename from packages/core/src/utils-hoist/tracing.ts rename to packages/utils/src/tracing.ts diff --git a/packages/core/src/utils-hoist/url.ts b/packages/utils/src/url.ts similarity index 100% rename from packages/core/src/utils-hoist/url.ts rename to packages/utils/src/url.ts diff --git a/packages/core/src/utils-hoist/vendor/escapeStringForRegex.ts b/packages/utils/src/vendor/escapeStringForRegex.ts similarity index 100% rename from packages/core/src/utils-hoist/vendor/escapeStringForRegex.ts rename to packages/utils/src/vendor/escapeStringForRegex.ts diff --git a/packages/core/src/utils-hoist/vendor/getIpAddress.ts b/packages/utils/src/vendor/getIpAddress.ts similarity index 100% rename from packages/core/src/utils-hoist/vendor/getIpAddress.ts rename to packages/utils/src/vendor/getIpAddress.ts diff --git a/packages/core/src/utils-hoist/vendor/supportsHistory.ts b/packages/utils/src/vendor/supportsHistory.ts similarity index 100% rename from packages/core/src/utils-hoist/vendor/supportsHistory.ts rename to packages/utils/src/vendor/supportsHistory.ts diff --git a/packages/core/src/utils-hoist/vercelWaitUntil.ts b/packages/utils/src/vercelWaitUntil.ts similarity index 100% rename from packages/core/src/utils-hoist/vercelWaitUntil.ts rename to packages/utils/src/vercelWaitUntil.ts diff --git a/packages/core/src/utils-hoist/version.ts b/packages/utils/src/version.ts similarity index 100% rename from packages/core/src/utils-hoist/version.ts rename to packages/utils/src/version.ts diff --git a/packages/core/src/utils-hoist/worldwide.ts b/packages/utils/src/worldwide.ts similarity index 95% rename from packages/core/src/utils-hoist/worldwide.ts rename to packages/utils/src/worldwide.ts index 62b2d3d397b6..2a1ca7b958d8 100644 --- a/packages/core/src/utils-hoist/worldwide.ts +++ b/packages/utils/src/worldwide.ts @@ -28,9 +28,9 @@ interface SentryCarrier { globalMetricsAggregators?: WeakMap | undefined; logger?: typeof logger; - /** Overwrites TextEncoder used in `@sentry/core`, need for `react-native@0.73` and older */ + /** Overwrites TextEncoder used in `@sentry/utils`, need for `react-native@0.73` and older */ encodePolyfill?: (input: string) => Uint8Array; - /** Overwrites TextDecoder used in `@sentry/core`, need for `react-native@0.73` and older */ + /** Overwrites TextDecoder used in `@sentry/utils`, need for `react-native@0.73` and older */ decodePolyfill?: (input: Uint8Array) => string; } diff --git a/packages/core/test/utils-hoist/aggregate-errors.test.ts b/packages/utils/test/aggregate-errors.test.ts similarity index 98% rename from packages/core/test/utils-hoist/aggregate-errors.test.ts rename to packages/utils/test/aggregate-errors.test.ts index 3d13a4d29b21..7cfd8e0b82da 100644 --- a/packages/core/test/utils-hoist/aggregate-errors.test.ts +++ b/packages/utils/test/aggregate-errors.test.ts @@ -1,6 +1,6 @@ import type { Event, EventHint, Exception, ExtendedError, StackParser } from '@sentry/types'; -import { applyAggregateErrorsToEvent } from '../../src/utils-hoist/aggregate-errors'; -import { createStackParser } from '../../src/utils-hoist/stacktrace'; + +import { applyAggregateErrorsToEvent, createStackParser } from '../src/index'; const stackParser = createStackParser([0, line => ({ filename: line })]); const exceptionFromError = (_stackParser: StackParser, ex: Error): Exception => { diff --git a/packages/core/test/utils-hoist/array.test.ts b/packages/utils/test/array.test.ts similarity index 93% rename from packages/core/test/utils-hoist/array.test.ts rename to packages/utils/test/array.test.ts index fb788d48cea9..ebf702508585 100644 --- a/packages/core/test/utils-hoist/array.test.ts +++ b/packages/utils/test/array.test.ts @@ -1,5 +1,5 @@ -import type { NestedArray } from '../../src/utils-hoist/array'; -import { flatten } from '../../src/utils-hoist/array'; +import type { NestedArray } from '../src/array'; +import { flatten } from '../src/array'; describe('flatten', () => { it('should return the same array when input is a flat array', () => { diff --git a/packages/core/test/utils-hoist/baggage.test.ts b/packages/utils/test/baggage.test.ts similarity index 92% rename from packages/core/test/utils-hoist/baggage.test.ts rename to packages/utils/test/baggage.test.ts index 9268e178b3a6..539a34e44d9c 100644 --- a/packages/core/test/utils-hoist/baggage.test.ts +++ b/packages/utils/test/baggage.test.ts @@ -1,7 +1,4 @@ -import { - baggageHeaderToDynamicSamplingContext, - dynamicSamplingContextToSentryBaggageHeader, -} from '../../src/utils-hoist/baggage'; +import { baggageHeaderToDynamicSamplingContext, dynamicSamplingContextToSentryBaggageHeader } from '../src/baggage'; test.each([ ['', undefined], diff --git a/packages/core/test/utils-hoist/breadcrumb-log-level.test.ts b/packages/utils/test/breadcrumb-log-level.test.ts similarity index 81% rename from packages/core/test/utils-hoist/breadcrumb-log-level.test.ts rename to packages/utils/test/breadcrumb-log-level.test.ts index 6be625bb0a63..49792d2726bb 100644 --- a/packages/core/test/utils-hoist/breadcrumb-log-level.test.ts +++ b/packages/utils/test/breadcrumb-log-level.test.ts @@ -1,4 +1,4 @@ -import { getBreadcrumbLogLevelFromHttpStatusCode } from '../../src/utils-hoist/breadcrumb-log-level'; +import { getBreadcrumbLogLevelFromHttpStatusCode } from '../src/breadcrumb-log-level'; describe('getBreadcrumbLogLevelFromHttpStatusCode()', () => { it.each([ diff --git a/packages/core/test/utils-hoist/browser.test.ts b/packages/utils/test/browser.test.ts similarity index 97% rename from packages/core/test/utils-hoist/browser.test.ts rename to packages/utils/test/browser.test.ts index c86570ee7fb0..8b92f28a8536 100644 --- a/packages/core/test/utils-hoist/browser.test.ts +++ b/packages/utils/test/browser.test.ts @@ -1,6 +1,6 @@ import { JSDOM } from 'jsdom'; -import { getDomElement, htmlTreeAsString } from '../../src/utils-hoist/browser'; +import { getDomElement, htmlTreeAsString } from '../src/browser'; beforeAll(() => { const dom = new JSDOM(); diff --git a/packages/core/test/utils-hoist/buildPolyfills/nullishCoalesce.test.ts b/packages/utils/test/buildPolyfills/nullishCoalesce.test.ts similarity index 85% rename from packages/core/test/utils-hoist/buildPolyfills/nullishCoalesce.test.ts rename to packages/utils/test/buildPolyfills/nullishCoalesce.test.ts index 11c83b0711d9..d2a1d98d8a05 100644 --- a/packages/core/test/utils-hoist/buildPolyfills/nullishCoalesce.test.ts +++ b/packages/utils/test/buildPolyfills/nullishCoalesce.test.ts @@ -1,7 +1,5 @@ -// TODO(v9): Remove this test - -import { _nullishCoalesce } from '../../../src/utils-hoist/buildPolyfills'; -import type { Value } from '../../../src/utils-hoist/buildPolyfills/types'; +import { _nullishCoalesce } from '../../src/buildPolyfills'; +import type { Value } from '../../src/buildPolyfills/types'; import { _nullishCoalesce as _nullishCoalesceOrig } from './originals'; const dogStr = 'dogs are great!'; diff --git a/packages/core/test/utils-hoist/buildPolyfills/optionalChain.test.ts b/packages/utils/test/buildPolyfills/optionalChain.test.ts similarity index 90% rename from packages/core/test/utils-hoist/buildPolyfills/optionalChain.test.ts rename to packages/utils/test/buildPolyfills/optionalChain.test.ts index bd7a7bb052fb..4ad6f14befde 100644 --- a/packages/core/test/utils-hoist/buildPolyfills/optionalChain.test.ts +++ b/packages/utils/test/buildPolyfills/optionalChain.test.ts @@ -1,14 +1,12 @@ -// TODO(v9): Remove this test +import { default as arrayFlat } from 'array.prototype.flat'; -import { shim as arrayFlatShim } from 'array.prototype.flat'; - -import { _optionalChain } from '../../../src/utils-hoist/buildPolyfills'; -import type { GenericFunction, GenericObject, Value } from '../../../src/utils-hoist/buildPolyfills/types'; +import { _optionalChain } from '../../src/buildPolyfills'; +import type { GenericFunction, GenericObject, Value } from '../../src/buildPolyfills/types'; import { _optionalChain as _optionalChainOrig } from './originals'; // Older versions of Node don't have `Array.prototype.flat`, which crashes these tests. On newer versions that do have // it, this is a no-op. -arrayFlatShim(); +arrayFlat.shim(); type OperationType = 'access' | 'call' | 'optionalAccess' | 'optionalCall'; type OperationExecutor = @@ -80,12 +78,9 @@ describe('_optionalChain', () => { it.each(testCases)('%s', (_, initialChainComponent, operations, expectedValue) => { // `operations` is flattened and spread in order to undo the wrapping done in the test cases for TS purposes. - // @ts-expect-error this is what we're testing expect(_optionalChain([initialChainComponent, ...operations.flat()])).toEqual( - // @ts-expect-error this is what we're testing _optionalChainOrig([initialChainComponent, ...operations.flat()]), ); - // @ts-expect-error this is what we're testing expect(_optionalChain([initialChainComponent, ...operations.flat()])).toEqual(expectedValue); }); }); diff --git a/packages/utils/test/buildPolyfills/originals.d.ts b/packages/utils/test/buildPolyfills/originals.d.ts new file mode 100644 index 000000000000..c2032b265476 --- /dev/null +++ b/packages/utils/test/buildPolyfills/originals.d.ts @@ -0,0 +1,13 @@ +// NOTE: Unlike other types files, this is NOT auto-generated by our build scripts. Since these functions are the +// originals of functions we adapted from Rollup and Sucrase, there's no reason they should ever change, but if they do, +// this file needs to be regenerated, by running +// `yarn tsc --allowJs --skipLibCheck --declaration --emitDeclarationOnly test/buildPolyfills/originals.js` +// from within the `utils` package. Keep in mind that running that command will clobber this note, so make sure to copy +// it before you regenerate the types, so you can add it back in.) + +export function _asyncNullishCoalesce(lhs: any, rhsFn: any): Promise; +export function _asyncOptionalChain(ops: any): Promise; +export function _asyncOptionalChainDelete(ops: any): Promise; +export function _nullishCoalesce(lhs: any, rhsFn: any): any; +export function _optionalChain(ops: any): any; +export function _optionalChainDelete(ops: any): any; diff --git a/packages/core/test/utils-hoist/buildPolyfills/originals.ts b/packages/utils/test/buildPolyfills/originals.js similarity index 94% rename from packages/core/test/utils-hoist/buildPolyfills/originals.ts rename to packages/utils/test/buildPolyfills/originals.js index a504d5f0d871..5ec688de93ac 100644 --- a/packages/core/test/utils-hoist/buildPolyfills/originals.ts +++ b/packages/utils/test/buildPolyfills/originals.js @@ -1,8 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck this is just used for tests - -// TODO(v9): Remove this file - // Originals of the buildPolyfills from Sucrase and Rollup we use (which we have adapted in various ways), preserved here for testing, to prove that // the modified versions do the same thing the originals do. diff --git a/packages/core/test/utils-hoist/clientreport.test.ts b/packages/utils/test/clientreport.test.ts similarity index 91% rename from packages/core/test/utils-hoist/clientreport.test.ts rename to packages/utils/test/clientreport.test.ts index 698ad195d7fa..04a2a4fe7334 100644 --- a/packages/core/test/utils-hoist/clientreport.test.ts +++ b/packages/utils/test/clientreport.test.ts @@ -1,7 +1,7 @@ import type { ClientReport } from '@sentry/types'; -import { createClientReportEnvelope } from '../../src/utils-hoist/clientreport'; -import { parseEnvelope, serializeEnvelope } from '../../src/utils-hoist/envelope'; +import { createClientReportEnvelope } from '../src/clientreport'; +import { parseEnvelope, serializeEnvelope } from '../src/envelope'; const DEFAULT_DISCARDED_EVENTS: ClientReport['discarded_events'] = [ { diff --git a/packages/core/test/utils-hoist/cookie.test.ts b/packages/utils/test/cookie.test.ts similarity index 97% rename from packages/core/test/utils-hoist/cookie.test.ts rename to packages/utils/test/cookie.test.ts index eca98a592f00..2110f384c9b6 100644 --- a/packages/core/test/utils-hoist/cookie.test.ts +++ b/packages/utils/test/cookie.test.ts @@ -28,7 +28,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { parseCookie } from '../../src/utils-hoist/cookie'; +import { parseCookie } from '../src/cookie'; describe('parseCookie(str)', function () { it('should parse cookie string to object', function () { diff --git a/packages/core/test/utils-hoist/dsn.test.ts b/packages/utils/test/dsn.test.ts similarity index 97% rename from packages/core/test/utils-hoist/dsn.test.ts rename to packages/utils/test/dsn.test.ts index 6f70c83d0c60..e1aadb893e8e 100644 --- a/packages/core/test/utils-hoist/dsn.test.ts +++ b/packages/utils/test/dsn.test.ts @@ -1,6 +1,6 @@ -import { DEBUG_BUILD } from '../../src/utils-hoist/debug-build'; -import { dsnToString, makeDsn } from '../../src/utils-hoist/dsn'; -import { logger } from '../../src/utils-hoist/logger'; +import { DEBUG_BUILD } from '../src/debug-build'; +import { dsnToString, makeDsn } from '../src/dsn'; +import { logger } from '../src/logger'; function testIf(condition: boolean): jest.It { return condition ? test : test.skip; diff --git a/packages/core/test/utils-hoist/envelope.test.ts b/packages/utils/test/envelope.test.ts similarity index 97% rename from packages/core/test/utils-hoist/envelope.test.ts rename to packages/utils/test/envelope.test.ts index 9ebfd447fb14..fa2df9cc159a 100644 --- a/packages/core/test/utils-hoist/envelope.test.ts +++ b/packages/utils/test/envelope.test.ts @@ -14,9 +14,9 @@ import { forEachEnvelopeItem, parseEnvelope, serializeEnvelope, -} from '../../src/utils-hoist/envelope'; -import type { InternalGlobal } from '../../src/utils-hoist/worldwide'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +} from '../src/envelope'; +import type { InternalGlobal } from '../src/worldwide'; +import { GLOBAL_OBJ } from '../src/worldwide'; describe('envelope', () => { describe('createSpanEnvelope()', () => { diff --git a/packages/core/test/utils-hoist/eventbuilder.test.ts b/packages/utils/test/eventbuilder.test.ts similarity index 95% rename from packages/core/test/utils-hoist/eventbuilder.test.ts rename to packages/utils/test/eventbuilder.test.ts index e12726746e04..7c67571e753e 100644 --- a/packages/core/test/utils-hoist/eventbuilder.test.ts +++ b/packages/utils/test/eventbuilder.test.ts @@ -1,7 +1,6 @@ import type { Client } from '@sentry/types'; -import { eventFromUnknownInput } from '../../src/utils-hoist/eventbuilder'; -import { nodeStackLineParser } from '../../src/utils-hoist/node-stack-trace'; -import { createStackParser } from '../../src/utils-hoist/stacktrace'; + +import { createStackParser, eventFromUnknownInput, nodeStackLineParser } from '../src'; const stackParser = createStackParser(nodeStackLineParser()); diff --git a/packages/core/test/utils-hoist/instrument.test.ts b/packages/utils/test/instrument.test.ts similarity index 79% rename from packages/core/test/utils-hoist/instrument.test.ts rename to packages/utils/test/instrument.test.ts index 938ba8f17e3e..440a19121a1a 100644 --- a/packages/core/test/utils-hoist/instrument.test.ts +++ b/packages/utils/test/instrument.test.ts @@ -1,4 +1,4 @@ -import { maybeInstrument } from '../../src/utils-hoist/instrument/handlers'; +import { maybeInstrument } from '../src'; describe('maybeInstrument', () => { test('does not throw when instrumenting fails', () => { diff --git a/packages/core/test/utils-hoist/instrument/fetch.test.ts b/packages/utils/test/instrument/fetch.test.ts similarity index 93% rename from packages/core/test/utils-hoist/instrument/fetch.test.ts rename to packages/utils/test/instrument/fetch.test.ts index fc6102d6b617..ea29e0c16c3e 100644 --- a/packages/core/test/utils-hoist/instrument/fetch.test.ts +++ b/packages/utils/test/instrument/fetch.test.ts @@ -1,4 +1,4 @@ -import { parseFetchArgs } from '../../../src/utils-hoist/instrument/fetch'; +import { parseFetchArgs } from '../../src/instrument/fetch'; describe('instrument > parseFetchArgs', () => { it.each([ diff --git a/packages/core/test/utils-hoist/is.test.ts b/packages/utils/test/is.test.ts similarity index 97% rename from packages/core/test/utils-hoist/is.test.ts rename to packages/utils/test/is.test.ts index 44feba601d04..853fae168681 100644 --- a/packages/core/test/utils-hoist/is.test.ts +++ b/packages/utils/test/is.test.ts @@ -8,9 +8,9 @@ import { isPrimitive, isThenable, isVueViewModel, -} from '../../src/utils-hoist/is'; -import { supportsDOMError, supportsDOMException, supportsErrorEvent } from '../../src/utils-hoist/supports'; -import { resolvedSyncPromise } from '../../src/utils-hoist/syncpromise'; +} from '../src/is'; +import { supportsDOMError, supportsDOMException, supportsErrorEvent } from '../src/supports'; +import { resolvedSyncPromise } from '../src/syncpromise'; import { testOnlyIfNodeVersionAtLeast } from './testutils'; class SentryError extends Error { diff --git a/packages/core/test/utils-hoist/lru.test.ts b/packages/utils/test/lru.test.ts similarity index 94% rename from packages/core/test/utils-hoist/lru.test.ts rename to packages/utils/test/lru.test.ts index 39c83a1fbf8f..15f638e9cfa1 100644 --- a/packages/core/test/utils-hoist/lru.test.ts +++ b/packages/utils/test/lru.test.ts @@ -1,4 +1,4 @@ -import { LRUMap } from '../../src/utils-hoist/lru'; +import { LRUMap } from '../src/lru'; describe('LRUMap', () => { test('evicts older entries when reaching max size', () => { diff --git a/packages/core/test/utils-hoist/misc.test.ts b/packages/utils/test/misc.test.ts similarity index 99% rename from packages/core/test/utils-hoist/misc.test.ts rename to packages/utils/test/misc.test.ts index b2c37758e79c..14f3e88c0f0b 100644 --- a/packages/core/test/utils-hoist/misc.test.ts +++ b/packages/utils/test/misc.test.ts @@ -7,7 +7,7 @@ import { checkOrSetAlreadyCaught, getEventDescription, uuid4, -} from '../../src/utils-hoist/misc'; +} from '../src/misc'; describe('getEventDescription()', () => { test('message event', () => { diff --git a/packages/core/test/utils-hoist/normalize-url.test.ts b/packages/utils/test/normalize-url.test.ts similarity index 97% rename from packages/core/test/utils-hoist/normalize-url.test.ts rename to packages/utils/test/normalize-url.test.ts index 080905058e1d..5df2bb5d6e35 100644 --- a/packages/core/test/utils-hoist/normalize-url.test.ts +++ b/packages/utils/test/normalize-url.test.ts @@ -1,4 +1,4 @@ -import { normalizeUrlToBase } from '../../src/utils-hoist/normalize'; +import { normalizeUrlToBase } from '../src/normalize'; describe('normalizeUrlToBase()', () => { it('Example app on Windows', () => { diff --git a/packages/core/test/utils-hoist/normalize.test.ts b/packages/utils/test/normalize.test.ts similarity index 99% rename from packages/core/test/utils-hoist/normalize.test.ts rename to packages/utils/test/normalize.test.ts index 985c0dbf8963..d8a8a1329352 100644 --- a/packages/core/test/utils-hoist/normalize.test.ts +++ b/packages/utils/test/normalize.test.ts @@ -2,9 +2,10 @@ * @jest-environment jsdom */ -import { addNonEnumerableProperty, normalize } from '../../src'; -import * as isModule from '../../src/utils-hoist/is'; -import * as stacktraceModule from '../../src/utils-hoist/stacktrace'; +import * as isModule from '../src/is'; +import { normalize } from '../src/normalize'; +import { addNonEnumerableProperty } from '../src/object'; +import * as stacktraceModule from '../src/stacktrace'; describe('normalize()', () => { describe('acts as a pass-through for simple-cases', () => { diff --git a/packages/core/test/utils-hoist/object.test.ts b/packages/utils/test/object.test.ts similarity index 95% rename from packages/core/test/utils-hoist/object.test.ts rename to packages/utils/test/object.test.ts index 7e39c463336c..2ba5a6c58fa3 100644 --- a/packages/core/test/utils-hoist/object.test.ts +++ b/packages/utils/test/object.test.ts @@ -12,7 +12,7 @@ import { markFunctionWrapped, objectify, urlEncode, -} from '../../src/utils-hoist/object'; +} from '../src/object'; import { testOnlyIfNodeVersionAtLeast } from './testutils'; describe('fill()', () => { @@ -31,29 +31,6 @@ describe('fill()', () => { expect(replacement).toBeCalled(); }); - test('does not throw on readonly properties', () => { - const originalFn = () => 41; - const source = { - get prop() { - return originalFn; - }, - set prop(_fn: () => number) { - throw new Error('OH NO, this is not writeable...'); - }, - }; - - expect(source.prop()).toEqual(41); - - const replacement = jest.fn().mockImplementation(() => { - return () => 42; - }); - fill(source, 'prop', replacement); - expect(replacement).toBeCalled(); - - expect(source.prop).toBe(originalFn); - expect(source.prop()).toEqual(41); - }); - test('can do anything inside replacement function', () => { const source = { foo: (): number => 42, diff --git a/packages/core/test/utils-hoist/path.test.ts b/packages/utils/test/path.test.ts similarity index 95% rename from packages/core/test/utils-hoist/path.test.ts rename to packages/utils/test/path.test.ts index 64dd5caf20ca..3ba750830f1b 100644 --- a/packages/core/test/utils-hoist/path.test.ts +++ b/packages/utils/test/path.test.ts @@ -1,4 +1,4 @@ -import { basename, dirname } from '../../src/utils-hoist/path'; +import { basename, dirname } from '../src/path'; describe('path', () => { describe('basename', () => { diff --git a/packages/core/test/utils-hoist/proagationContext.test.ts b/packages/utils/test/proagationContext.test.ts similarity index 76% rename from packages/core/test/utils-hoist/proagationContext.test.ts rename to packages/utils/test/proagationContext.test.ts index 5e895af0ba58..01c8569bde9b 100644 --- a/packages/core/test/utils-hoist/proagationContext.test.ts +++ b/packages/utils/test/proagationContext.test.ts @@ -1,4 +1,4 @@ -import { generatePropagationContext } from '../../src/utils-hoist/propagationContext'; +import { generatePropagationContext } from '../src/propagationContext'; describe('generatePropagationContext', () => { it('generates a new minimal propagation context', () => { diff --git a/packages/core/test/utils-hoist/promisebuffer.test.ts b/packages/utils/test/promisebuffer.test.ts similarity index 96% rename from packages/core/test/utils-hoist/promisebuffer.test.ts rename to packages/utils/test/promisebuffer.test.ts index 3357a06e820c..1dc2e1f993e8 100644 --- a/packages/core/test/utils-hoist/promisebuffer.test.ts +++ b/packages/utils/test/promisebuffer.test.ts @@ -1,5 +1,5 @@ -import { makePromiseBuffer } from '../../src/utils-hoist/promisebuffer'; -import { SyncPromise } from '../../src/utils-hoist/syncpromise'; +import { makePromiseBuffer } from '../src/promisebuffer'; +import { SyncPromise } from '../src/syncpromise'; describe('PromiseBuffer', () => { describe('add()', () => { diff --git a/packages/core/test/utils-hoist/ratelimit.test.ts b/packages/utils/test/ratelimit.test.ts similarity index 98% rename from packages/core/test/utils-hoist/ratelimit.test.ts rename to packages/utils/test/ratelimit.test.ts index 9a3f37bcf845..5833548727f7 100644 --- a/packages/core/test/utils-hoist/ratelimit.test.ts +++ b/packages/utils/test/ratelimit.test.ts @@ -1,11 +1,11 @@ -import type { RateLimits } from '../../src/utils-hoist/ratelimit'; +import type { RateLimits } from '../src/ratelimit'; import { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits, -} from '../../src/utils-hoist/ratelimit'; +} from '../src/ratelimit'; describe('parseRetryAfterHeader()', () => { test('should fallback to 60s when incorrect header provided', () => { diff --git a/packages/core/test/utils-hoist/requestdata.test.ts b/packages/utils/test/requestdata.test.ts similarity index 99% rename from packages/core/test/utils-hoist/requestdata.test.ts rename to packages/utils/test/requestdata.test.ts index 0b1f198ebddc..90c734f23f2c 100644 --- a/packages/core/test/utils-hoist/requestdata.test.ts +++ b/packages/utils/test/requestdata.test.ts @@ -1,7 +1,7 @@ import type * as net from 'net'; -import { addRequestDataToEvent, extractPathForTransaction, extractRequestData } from '@sentry/core'; import type { Event, PolymorphicRequest, TransactionSource, User } from '@sentry/types'; -import { getClientIPAddress } from '../../src/utils-hoist/vendor/getIpAddress'; +import { addRequestDataToEvent, extractPathForTransaction, extractRequestData } from '@sentry/utils'; +import { getClientIPAddress } from '../src/vendor/getIpAddress'; describe('addRequestDataToEvent', () => { let mockEvent: Event; diff --git a/packages/core/test/utils-hoist/severity.test.ts b/packages/utils/test/severity.test.ts similarity index 94% rename from packages/core/test/utils-hoist/severity.test.ts rename to packages/utils/test/severity.test.ts index 30e3dbb90e97..51f66e815288 100644 --- a/packages/core/test/utils-hoist/severity.test.ts +++ b/packages/utils/test/severity.test.ts @@ -1,4 +1,4 @@ -import { severityLevelFromString, validSeverityLevels } from '../../src/utils-hoist/severity'; +import { severityLevelFromString, validSeverityLevels } from '../src/severity'; describe('severityLevelFromString()', () => { test("converts 'warn' to 'warning'", () => { diff --git a/packages/core/test/utils-hoist/stacktrace.test.ts b/packages/utils/test/stacktrace.test.ts similarity index 98% rename from packages/core/test/utils-hoist/stacktrace.test.ts rename to packages/utils/test/stacktrace.test.ts index 22a50f3f71de..f1ef0454a71a 100644 --- a/packages/core/test/utils-hoist/stacktrace.test.ts +++ b/packages/utils/test/stacktrace.test.ts @@ -1,5 +1,4 @@ -import { nodeStackLineParser } from '../../src/utils-hoist/node-stack-trace'; -import { stripSentryFramesAndReverse } from '../../src/utils-hoist/stacktrace'; +import { nodeStackLineParser, stripSentryFramesAndReverse } from '../src'; describe('Stacktrace', () => { describe('stripSentryFramesAndReverse()', () => { diff --git a/packages/core/test/utils-hoist/string.test.ts b/packages/utils/test/string.test.ts similarity index 99% rename from packages/core/test/utils-hoist/string.test.ts rename to packages/utils/test/string.test.ts index bf959965cb45..64870c07fcba 100644 --- a/packages/core/test/utils-hoist/string.test.ts +++ b/packages/utils/test/string.test.ts @@ -1,4 +1,4 @@ -import { isMatchingPattern, stringMatchesSomePattern, truncate } from '../../src/utils-hoist/string'; +import { isMatchingPattern, stringMatchesSomePattern, truncate } from '../src/string'; describe('truncate()', () => { test('it works as expected', () => { diff --git a/packages/core/test/utils-hoist/syncpromise.test.ts b/packages/utils/test/syncpromise.test.ts similarity index 99% rename from packages/core/test/utils-hoist/syncpromise.test.ts rename to packages/utils/test/syncpromise.test.ts index 9dce11645b25..b3074b3c1b32 100644 --- a/packages/core/test/utils-hoist/syncpromise.test.ts +++ b/packages/utils/test/syncpromise.test.ts @@ -1,4 +1,4 @@ -import { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from '../../src/utils-hoist/syncpromise'; +import { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from '../src/syncpromise'; describe('SyncPromise', () => { test('simple', async () => { diff --git a/packages/core/test/utils-hoist/testutils.ts b/packages/utils/test/testutils.ts similarity index 100% rename from packages/core/test/utils-hoist/testutils.ts rename to packages/utils/test/testutils.ts diff --git a/packages/core/test/utils-hoist/tracing.test.ts b/packages/utils/test/tracing.test.ts similarity index 99% rename from packages/core/test/utils-hoist/tracing.test.ts rename to packages/utils/test/tracing.test.ts index 95e95c5075f9..399c37104445 100644 --- a/packages/core/test/utils-hoist/tracing.test.ts +++ b/packages/utils/test/tracing.test.ts @@ -1,4 +1,4 @@ -import { extractTraceparentData, propagationContextFromHeaders } from '../../src/utils-hoist/tracing'; +import { extractTraceparentData, propagationContextFromHeaders } from '../src/tracing'; const EXAMPLE_SENTRY_TRACE = '12312012123120121231201212312012-1121201211212012-1'; const EXAMPLE_BAGGAGE = 'sentry-release=1.2.3,sentry-foo=bar,other=baz'; diff --git a/packages/utils/test/tsconfig.json b/packages/utils/test/tsconfig.json new file mode 100644 index 000000000000..38ca0b13bcdd --- /dev/null +++ b/packages/utils/test/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.test.json" +} diff --git a/packages/core/test/utils-hoist/types/typedef.test.ts b/packages/utils/test/types/typedef.test.ts similarity index 100% rename from packages/core/test/utils-hoist/types/typedef.test.ts rename to packages/utils/test/types/typedef.test.ts diff --git a/packages/core/test/utils-hoist/url.test.ts b/packages/utils/test/url.test.ts similarity index 96% rename from packages/core/test/utils-hoist/url.test.ts rename to packages/utils/test/url.test.ts index fd8b861516ab..c6926fb74968 100644 --- a/packages/core/test/utils-hoist/url.test.ts +++ b/packages/utils/test/url.test.ts @@ -1,9 +1,4 @@ -import { - getNumberOfUrlSegments, - getSanitizedUrlString, - parseUrl, - stripUrlQueryAndFragment, -} from '../../src/utils-hoist/url'; +import { getNumberOfUrlSegments, getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from '../src/url'; describe('stripQueryStringAndFragment', () => { const urlString = 'http://dogs.are.great:1231/yay/'; diff --git a/packages/core/test/utils-hoist/vercelWaitUntil.test.ts b/packages/utils/test/vercelWaitUntil.test.ts similarity index 90% rename from packages/core/test/utils-hoist/vercelWaitUntil.test.ts rename to packages/utils/test/vercelWaitUntil.test.ts index b8b6452cbac2..881bf265607b 100644 --- a/packages/core/test/utils-hoist/vercelWaitUntil.test.ts +++ b/packages/utils/test/vercelWaitUntil.test.ts @@ -1,5 +1,5 @@ -import { vercelWaitUntil } from '../../src/utils-hoist/vercelWaitUntil'; -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +import { vercelWaitUntil } from '../src/vercelWaitUntil'; +import { GLOBAL_OBJ } from '../src/worldwide'; describe('vercelWaitUntil', () => { it('should do nothing if GLOBAL_OBJ does not have the @vercel/request-context symbol', () => { diff --git a/packages/core/test/utils-hoist/worldwide.test.ts b/packages/utils/test/worldwide.test.ts similarity index 83% rename from packages/core/test/utils-hoist/worldwide.test.ts rename to packages/utils/test/worldwide.test.ts index a3106e953861..3b85eb06fdd1 100644 --- a/packages/core/test/utils-hoist/worldwide.test.ts +++ b/packages/utils/test/worldwide.test.ts @@ -1,4 +1,4 @@ -import { GLOBAL_OBJ } from '../../src/utils-hoist/worldwide'; +import { GLOBAL_OBJ } from '../src/worldwide'; describe('GLOBAL_OBJ', () => { test('should return the same object', () => { diff --git a/packages/utils/tsconfig.test.json b/packages/utils/tsconfig.test.json new file mode 100644 index 000000000000..0f755903fa64 --- /dev/null +++ b/packages/utils/tsconfig.test.json @@ -0,0 +1,23 @@ +{ + "extends": "./tsconfig.json", + + "include": ["test/**/*"], + + "compilerOptions": { + // should include all types from `./tsconfig.json` plus types for all test frameworks used + "types": ["node", "jest"], + + // other package-specific, test-specific options + // this is necessary in order to be able to handle the buildPolyfills `originals.js` which is used for testing + "allowJs": true, + + // `es2020` is the recommended `lib` and `target` for Node 14 + // see https://github.com/tsconfig/bases/blob/main/bases/node14.json + "lib": ["dom", "es2020"], + "module": "commonjs", + "target": "es2020", + + // so we don't have to worry about how libraries we use export things + "esModuleInterop": true + } +} diff --git a/packages/vercel-edge/package.json b/packages/vercel-edge/package.json index c9cf344a6151..af1370d25f22 100644 --- a/packages/vercel-edge/package.json +++ b/packages/vercel-edge/package.json @@ -41,7 +41,8 @@ "dependencies": { "@opentelemetry/api": "^1.9.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "devDependencies": { "@edge-runtime/types": "3.0.1", diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index 1675e9b5b359..4eea3f90d2d8 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -18,7 +18,7 @@ export type { Thread, User, } from '@sentry/types'; -export type { AddRequestDataToEventOptions } from '@sentry/core'; +export type { AddRequestDataToEventOptions } from '@sentry/utils'; export type { VercelEdgeOptions } from './types'; @@ -74,7 +74,6 @@ export { linkedErrorsIntegration, requestDataIntegration, extraErrorDataIntegration, - // eslint-disable-next-line deprecation/deprecation debugIntegration, dedupeIntegration, rewriteFramesIntegration, diff --git a/packages/vercel-edge/src/integrations/wintercg-fetch.ts b/packages/vercel-edge/src/integrations/wintercg-fetch.ts index 7371ebcec8b7..4dd4bf399e4c 100644 --- a/packages/vercel-edge/src/integrations/wintercg-fetch.ts +++ b/packages/vercel-edge/src/integrations/wintercg-fetch.ts @@ -1,10 +1,4 @@ import { addBreadcrumb, defineIntegration, getClient, instrumentFetchRequest, isSentryRequestUrl } from '@sentry/core'; -import { - LRUMap, - addFetchInstrumentationHandler, - getBreadcrumbLogLevelFromHttpStatusCode, - stringMatchesSomePattern, -} from '@sentry/core'; import type { Client, FetchBreadcrumbData, @@ -13,6 +7,12 @@ import type { IntegrationFn, Span, } from '@sentry/types'; +import { + LRUMap, + addFetchInstrumentationHandler, + getBreadcrumbLogLevelFromHttpStatusCode, + stringMatchesSomePattern, +} from '@sentry/utils'; const INTEGRATION_NAME = 'WinterCGFetch'; diff --git a/packages/vercel-edge/src/sdk.ts b/packages/vercel-edge/src/sdk.ts index 141a3ba19ff5..4fa8415b2184 100644 --- a/packages/vercel-edge/src/sdk.ts +++ b/packages/vercel-edge/src/sdk.ts @@ -8,6 +8,7 @@ import { linkedErrorsIntegration, requestDataIntegration, } from '@sentry/core'; +import type { Client, Integration, Options } from '@sentry/types'; import { GLOBAL_OBJ, SDK_VERSION, @@ -15,8 +16,7 @@ import { logger, nodeStackLineParser, stackParserFromStackParserOptions, -} from '@sentry/core'; -import type { Client, Integration, Options } from '@sentry/types'; +} from '@sentry/utils'; import { DiagLogLevel, diag } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; diff --git a/packages/vercel-edge/src/transports/index.ts b/packages/vercel-edge/src/transports/index.ts index ade9f83944f7..b938647b4415 100644 --- a/packages/vercel-edge/src/transports/index.ts +++ b/packages/vercel-edge/src/transports/index.ts @@ -1,6 +1,6 @@ import { createTransport, suppressTracing } from '@sentry/core'; -import { SentryError } from '@sentry/core'; import type { BaseTransportOptions, Transport, TransportMakeRequestResponse, TransportRequest } from '@sentry/types'; +import { SentryError } from '@sentry/utils'; export interface VercelEdgeTransportOptions extends BaseTransportOptions { /** Fetch API init parameters. */ diff --git a/packages/vercel-edge/src/vendored/async-local-storage-context-manager.ts b/packages/vercel-edge/src/vendored/async-local-storage-context-manager.ts index 67828f4c852e..99520a3c0362 100644 --- a/packages/vercel-edge/src/vendored/async-local-storage-context-manager.ts +++ b/packages/vercel-edge/src/vendored/async-local-storage-context-manager.ts @@ -28,7 +28,7 @@ import type { Context } from '@opentelemetry/api'; import { ROOT_CONTEXT } from '@opentelemetry/api'; -import { GLOBAL_OBJ, logger } from '@sentry/core'; +import { GLOBAL_OBJ, logger } from '@sentry/utils'; import type { AsyncLocalStorage } from 'async_hooks'; import { DEBUG_BUILD } from '../debug-build'; import { AbstractAsyncHooksContextManager } from './abstract-async-hooks-context-manager'; diff --git a/packages/vercel-edge/test/async.test.ts b/packages/vercel-edge/test/async.test.ts index 82affdc49639..75c7d56803cd 100644 --- a/packages/vercel-edge/test/async.test.ts +++ b/packages/vercel-edge/test/async.test.ts @@ -1,6 +1,6 @@ import { Scope, getCurrentScope, getGlobalScope, getIsolationScope, withIsolationScope, withScope } from '@sentry/core'; -import { GLOBAL_OBJ } from '@sentry/core'; import { setOpenTelemetryContextAsyncContextStrategy } from '@sentry/opentelemetry'; +import { GLOBAL_OBJ } from '@sentry/utils'; import { AsyncLocalStorage } from 'async_hooks'; import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; import { VercelEdgeClient } from '../src'; diff --git a/packages/vercel-edge/test/transports/index.test.ts b/packages/vercel-edge/test/transports/index.test.ts index 4534d1b8169a..c2ead21998be 100644 --- a/packages/vercel-edge/test/transports/index.test.ts +++ b/packages/vercel-edge/test/transports/index.test.ts @@ -1,7 +1,7 @@ import { afterAll, describe, expect, it, vi } from 'vitest'; -import { createEnvelope, serializeEnvelope } from '@sentry/core'; import type { EventEnvelope, EventItem } from '@sentry/types'; +import { createEnvelope, serializeEnvelope } from '@sentry/utils'; import type { VercelEdgeTransportOptions } from '../../src/transports'; import { IsolatedPromiseBuffer, makeEdgeTransport } from '../../src/transports'; diff --git a/packages/vercel-edge/test/wintercg-fetch.test.ts b/packages/vercel-edge/test/wintercg-fetch.test.ts index ac00e27dcac8..34328734cd83 100644 --- a/packages/vercel-edge/test/wintercg-fetch.test.ts +++ b/packages/vercel-edge/test/wintercg-fetch.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import * as sentryCore from '@sentry/core'; -import * as sentryUtils from '@sentry/core'; -import { createStackParser } from '@sentry/core'; import type { HandlerDataFetch, Integration } from '@sentry/types'; +import * as sentryUtils from '@sentry/utils'; +import { createStackParser } from '@sentry/utils'; import { VercelEdgeClient } from '../src/index'; import { winterCGFetchIntegration } from '../src/integrations/wintercg-fetch'; diff --git a/packages/vue/package.json b/packages/vue/package.json index b8192ba3771b..61548306b124 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -41,7 +41,8 @@ "dependencies": { "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "peerDependencies": { "pinia": "2.x", diff --git a/packages/vue/src/errorhandler.ts b/packages/vue/src/errorhandler.ts index 95ca6ce483c0..07caeaf0f9cf 100644 --- a/packages/vue/src/errorhandler.ts +++ b/packages/vue/src/errorhandler.ts @@ -1,5 +1,5 @@ import { captureException } from '@sentry/core'; -import { consoleSandbox } from '@sentry/core'; +import { consoleSandbox } from '@sentry/utils'; import type { ViewModel, Vue, VueOptions } from './types'; import { formatComponentName, generateComponentTrace } from './vendor/components'; diff --git a/packages/vue/src/integration.ts b/packages/vue/src/integration.ts index c7b7145ac4b1..900fa686dbcf 100644 --- a/packages/vue/src/integration.ts +++ b/packages/vue/src/integration.ts @@ -1,6 +1,6 @@ import { defineIntegration, hasTracingEnabled } from '@sentry/core'; -import { GLOBAL_OBJ, arrayify, consoleSandbox } from '@sentry/core'; import type { Client, IntegrationFn } from '@sentry/types'; +import { GLOBAL_OBJ, arrayify, consoleSandbox } from '@sentry/utils'; import { DEFAULT_HOOKS } from './constants'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/vue/src/pinia.ts b/packages/vue/src/pinia.ts index 56e38c33bad7..a21273a7d54b 100644 --- a/packages/vue/src/pinia.ts +++ b/packages/vue/src/pinia.ts @@ -1,5 +1,5 @@ import { addBreadcrumb, getClient, getCurrentScope, getGlobalScope } from '@sentry/core'; -import { addNonEnumerableProperty } from '@sentry/core'; +import { addNonEnumerableProperty } from '@sentry/utils'; // Inline PiniaPlugin type type PiniaPlugin = (context: { diff --git a/packages/vue/src/tracing.ts b/packages/vue/src/tracing.ts index 8170516eea16..c00bdd184c20 100644 --- a/packages/vue/src/tracing.ts +++ b/packages/vue/src/tracing.ts @@ -1,6 +1,6 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getActiveSpan, startInactiveSpan } from '@sentry/browser'; -import { logger, timestampInSeconds } from '@sentry/core'; import type { Span } from '@sentry/types'; +import { logger, timestampInSeconds } from '@sentry/utils'; import { DEFAULT_HOOKS } from './constants'; import { DEBUG_BUILD } from './debug-build'; diff --git a/packages/vue/test/integration/VueIntegration.test.ts b/packages/vue/test/integration/VueIntegration.test.ts index 52445a353d23..9f0aeecaa722 100644 --- a/packages/vue/test/integration/VueIntegration.test.ts +++ b/packages/vue/test/integration/VueIntegration.test.ts @@ -4,8 +4,8 @@ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { logger } from '@sentry/core'; import type { Client } from '@sentry/types'; +import { logger } from '@sentry/utils'; import { createApp } from 'vue'; import * as Sentry from '../../src'; diff --git a/packages/wasm/package.json b/packages/wasm/package.json index 3572a9cc8d66..5f9bf6037a8b 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -41,7 +41,8 @@ "dependencies": { "@sentry/browser": "8.39.0", "@sentry/core": "8.39.0", - "@sentry/types": "8.39.0" + "@sentry/types": "8.39.0", + "@sentry/utils": "8.39.0" }, "scripts": { "build": "run-p build:transpile build:bundle build:types", diff --git a/scripts/build-types-watch.ts b/scripts/build-types-watch.ts index c94cb62f4063..8b29635479d0 100644 --- a/scripts/build-types-watch.ts +++ b/scripts/build-types-watch.ts @@ -2,7 +2,7 @@ /** * If `yarn build:types:watch` is run without types files previously having been created, the build will get stuck in an * errored state. This happens because lerna runs all of the packages' `yarn build:types:watch` statements in parallel, - * and so packages like `@sentry/browser` will at first be missing types they import from packages like `@sentry/core` + * and so packages like `@sentry/browser` will at first be missing types they import from packages like `@sentry/utils` * and `@sentry/types`, causing errors to be thrown. Normally this is fine, because as the dependencies' types get * built, file changes will be detected and the dependent packages' types will try again to build themselves. There * might be several rounds of this, but in theory, eventually all packages should end up with an error-free build. For