From dac51636fdefc9882b08891c7c205768cd90cc86 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Fri, 1 Mar 2024 14:43:58 +0100 Subject: [PATCH 1/2] Delete deprecated integrations `FunctionToString`, `InboundFilters` and `LinkedErrors` --- .../integrations/Breadcrumbs/dom/init.js | 2 +- .../integrations/Breadcrumbs/fetch/init.js | 2 +- .../integrations/Breadcrumbs/xhr/init.js | 2 +- .../manual-client/browser-context/init.js | 20 ++++++------- packages/browser/src/exports.ts | 7 ----- packages/browser/src/index.bundle.base.ts | 5 ---- packages/browser/src/index.ts | 6 ---- .../browser/src/integrations/breadcrumbs.ts | 30 +------------------ packages/browser/src/integrations/index.ts | 4 --- packages/browser/test/unit/index.test.ts | 15 ++++++---- .../unit/integrations/breadcrumbs.test.ts | 5 ++-- packages/bun/src/index.ts | 3 -- packages/core/src/index.ts | 11 ------- .../core/src/integrations/inboundfilters.ts | 26 ++-------------- packages/core/src/integrations/index.ts | 4 --- .../core/src/integrations/linkederrors.ts | 13 ++------ .../lib/integrations/inboundfilters.test.ts | 5 ++-- packages/deno/src/index.ts | 4 --- packages/node/src/index.ts | 4 --- .../node/src/integrations/contextlines.ts | 16 ++-------- packages/node/src/integrations/index.ts | 1 - packages/node/test/index.test.ts | 7 ++--- .../test/integrations/contextlines.test.ts | 18 ++++++----- packages/vercel-edge/src/index.ts | 4 +-- 24 files changed, 46 insertions(+), 168 deletions(-) delete mode 100644 packages/browser/src/integrations/index.ts delete mode 100644 packages/core/src/integrations/index.ts diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js index 9bd2d9649ed8..3cc53bd67d42 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js @@ -5,6 +5,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', defaultIntegrations: false, - integrations: [new Sentry.Integrations.Breadcrumbs()], + integrations: [new Sentry.breadcrumbsIntegration()], sampleRate: 1, }); diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js index 9bd2d9649ed8..3cc53bd67d42 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js @@ -5,6 +5,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', defaultIntegrations: false, - integrations: [new Sentry.Integrations.Breadcrumbs()], + integrations: [new Sentry.breadcrumbsIntegration()], sampleRate: 1, }); diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js index 9bd2d9649ed8..3cc53bd67d42 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js @@ -5,6 +5,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', defaultIntegrations: false, - integrations: [new Sentry.Integrations.Breadcrumbs()], + integrations: [new Sentry.breadcrumbsIntegration()], sampleRate: 1, }); diff --git a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js index cf70853184cd..33777734fe84 100644 --- a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js +++ b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/init.js @@ -1,23 +1,23 @@ import { - Breadcrumbs, BrowserClient, - FunctionToString, - HttpContext, Hub, - InboundFilters, - LinkedErrors, + breadcrumbsIntegration, dedupeIntegration, defaultStackParser, + functionToStringIntegration, + httpContextIntegration, + inboundFiltersIntegration, + linkedErrorsIntegration, makeFetchTransport, } from '@sentry/browser'; const integrations = [ - new Breadcrumbs(), - new FunctionToString(), + breadcrumbsIntegration(), + functionToStringIntegration(), dedupeIntegration(), - new HttpContext(), - new InboundFilters(), - new LinkedErrors(), + httpContextIntegration(), + inboundFiltersIntegration(), + linkedErrorsIntegration(), ]; const client = new BrowserClient({ diff --git a/packages/browser/src/exports.ts b/packages/browser/src/exports.ts index b066ebe3d9a4..45b0aa793052 100644 --- a/packages/browser/src/exports.ts +++ b/packages/browser/src/exports.ts @@ -60,10 +60,6 @@ export { withScope, withIsolationScope, withActiveSpan, - // eslint-disable-next-line deprecation/deprecation - FunctionToString, - // eslint-disable-next-line deprecation/deprecation - InboundFilters, functionToStringIntegration, inboundFiltersIntegration, dedupeIntegration, @@ -113,6 +109,3 @@ export { globalHandlersIntegration } from './integrations/globalhandlers'; export { httpContextIntegration } from './integrations/httpcontext'; export { linkedErrorsIntegration } from './integrations/linkederrors'; export { browserApiErrorsIntegration } from './integrations/browserapierrors'; - -// eslint-disable-next-line deprecation/deprecation -export { Breadcrumbs, LinkedErrors, HttpContext } from './integrations'; diff --git a/packages/browser/src/index.bundle.base.ts b/packages/browser/src/index.bundle.base.ts index 20bea46dca8b..5ccb0f1b1cf2 100644 --- a/packages/browser/src/index.bundle.base.ts +++ b/packages/browser/src/index.bundle.base.ts @@ -2,11 +2,9 @@ import type { IntegrationFn } from '@sentry/types/src'; export * from './exports'; -import { Integrations as CoreIntegrations } from '@sentry/core'; import type { Integration } from '@sentry/types'; import { WINDOW } from './helpers'; -import * as BrowserIntegrations from './integrations'; let windowIntegrations = {}; @@ -18,9 +16,6 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const INTEGRATIONS: Record Integration) | IntegrationFn> = { ...windowIntegrations, - // eslint-disable-next-line deprecation/deprecation - ...CoreIntegrations, - ...BrowserIntegrations, }; export { INTEGRATIONS as Integrations }; diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index d4c47e6f91eb..2a91a467ad89 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -1,9 +1,6 @@ export * from './exports'; -import { Integrations as CoreIntegrations } from '@sentry/core'; - import { WINDOW } from './helpers'; -import * as BrowserIntegrations from './integrations'; let windowIntegrations = {}; @@ -15,9 +12,6 @@ if (WINDOW.Sentry && WINDOW.Sentry.Integrations) { /** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */ const INTEGRATIONS = { ...windowIntegrations, - // eslint-disable-next-line deprecation/deprecation - ...CoreIntegrations, - ...BrowserIntegrations, }; // eslint-disable-next-line deprecation/deprecation diff --git a/packages/browser/src/integrations/breadcrumbs.ts b/packages/browser/src/integrations/breadcrumbs.ts index efef3f8057cd..d9e149ae4a0d 100644 --- a/packages/browser/src/integrations/breadcrumbs.ts +++ b/packages/browser/src/integrations/breadcrumbs.ts @@ -1,5 +1,5 @@ /* eslint-disable max-lines */ -import { addBreadcrumb, convertIntegrationFnToClass, defineIntegration, getClient } from '@sentry/core'; +import { addBreadcrumb, defineIntegration, getClient } from '@sentry/core'; import type { Client, Event as SentryEvent, @@ -8,8 +8,6 @@ import type { HandlerDataFetch, HandlerDataHistory, HandlerDataXhr, - Integration, - IntegrationClass, IntegrationFn, } from '@sentry/types'; import type { @@ -95,32 +93,6 @@ const _breadcrumbsIntegration = ((options: Partial = {}) => export const breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration); -/** - * Default Breadcrumbs instrumentations - * - * @deprecated Use `breadcrumbsIntegration()` instead. - */ -// eslint-disable-next-line deprecation/deprecation -export const Breadcrumbs = convertIntegrationFnToClass(INTEGRATION_NAME, breadcrumbsIntegration) as IntegrationClass< - Integration & { setup: (client: Client) => void } -> & { - new ( - options?: Partial<{ - console: boolean; - dom: - | boolean - | { - serializeAttribute?: string | string[]; - maxStringLength?: number; - }; - fetch: boolean; - history: boolean; - sentry: boolean; - xhr: boolean; - }>, - ): Integration; -}; - /** * Adds a breadcrumb for Sentry events or transactions if this option is enabled. */ diff --git a/packages/browser/src/integrations/index.ts b/packages/browser/src/integrations/index.ts deleted file mode 100644 index 66aa1d8f11a5..000000000000 --- a/packages/browser/src/integrations/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable deprecation/deprecation */ -export { Breadcrumbs } from './breadcrumbs'; -export { LinkedErrors } from './linkederrors'; -export { HttpContext } from './httpcontext'; diff --git a/packages/browser/test/unit/index.test.ts b/packages/browser/test/unit/index.test.ts index a7e4cf6afd2a..7ae117ba85a1 100644 --- a/packages/browser/test/unit/index.test.ts +++ b/packages/browser/test/unit/index.test.ts @@ -1,4 +1,10 @@ -import { InboundFilters, SDK_VERSION, getGlobalScope, getIsolationScope, getReportDialogEndpoint } from '@sentry/core'; +import { + SDK_VERSION, + getGlobalScope, + getIsolationScope, + getReportDialogEndpoint, + inboundFiltersIntegration, +} from '@sentry/core'; import type { WrappedFunction } from '@sentry/types'; import * as utils from '@sentry/utils'; @@ -264,16 +270,13 @@ describe('SentryBrowser', () => { expect(localBeforeSend).toHaveBeenCalledTimes(2); }); - + il; it('should use inboundfilter rules of bound client', async () => { const localBeforeSend = jest.fn(); const options = getDefaultBrowserClientOptions({ beforeSend: localBeforeSend, dsn, - integrations: [ - // eslint-disable-next-line deprecation/deprecation - new InboundFilters({ ignoreErrors: ['capture'] }), - ], + integrations: [inboundFiltersIntegration({ ignoreErrors: ['capture'] })], }); const client = new BrowserClient(options); setCurrentClient(client); diff --git a/packages/browser/test/unit/integrations/breadcrumbs.test.ts b/packages/browser/test/unit/integrations/breadcrumbs.test.ts index 28764c2cddfa..3c9713a872d2 100644 --- a/packages/browser/test/unit/integrations/breadcrumbs.test.ts +++ b/packages/browser/test/unit/integrations/breadcrumbs.test.ts @@ -1,6 +1,6 @@ import * as SentryCore from '@sentry/core'; -import { Breadcrumbs, BrowserClient, flush } from '../../../src'; +import { BrowserClient, breadcrumbsIntegration, flush } from '../../../src'; import { getDefaultBrowserClientOptions } from '../helper/browser-client-options'; describe('Breadcrumbs', () => { @@ -8,8 +8,7 @@ describe('Breadcrumbs', () => { const client = new BrowserClient({ ...getDefaultBrowserClientOptions(), dsn: 'https://username@domain/123', - // eslint-disable-next-line deprecation/deprecation - integrations: [new Breadcrumbs()], + integrations: [breadcrumbsIntegration()], }); SentryCore.setCurrentClient(client); diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index feb114d4723f..9dd77b898d26 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -119,14 +119,11 @@ export { init, } from './sdk'; -import { Integrations as CoreIntegrations } from '@sentry/core'; import { Integrations as NodeIntegrations } from '@sentry/node-experimental'; import { BunServer } from './integrations/bunserver'; export { bunServerIntegration } from './integrations/bunserver'; const INTEGRATIONS = { - // eslint-disable-next-line deprecation/deprecation - ...CoreIntegrations, ...NodeIntegrations, BunServer, }; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index b5bee258dae6..b8c451b432cd 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -97,12 +97,7 @@ export { DEFAULT_ENVIRONMENT } from './constants'; /* eslint-disable deprecation/deprecation */ export { ModuleMetadata } from './integrations/metadata'; export { RequestData } from './integrations/requestdata'; -export { InboundFilters } from './integrations/inboundfilters'; -export { FunctionToString } from './integrations/functiontostring'; -export { LinkedErrors } from './integrations/linkederrors'; export { addBreadcrumb } from './breadcrumbs'; -/* eslint-enable deprecation/deprecation */ -import * as INTEGRATIONS from './integrations'; export { functionToStringIntegration } from './integrations/functiontostring'; export { inboundFiltersIntegration } from './integrations/inboundfilters'; export { linkedErrorsIntegration } from './integrations/linkederrors'; @@ -118,9 +113,3 @@ export { metrics } from './metrics/exports'; export type { MetricData } from './metrics/exports'; export { metricsDefault } from './metrics/exports-default'; export { BrowserMetricsAggregator } from './metrics/browser-aggregator'; - -/** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */ -const Integrations = INTEGRATIONS; - -// eslint-disable-next-line deprecation/deprecation -export { Integrations }; diff --git a/packages/core/src/integrations/inboundfilters.ts b/packages/core/src/integrations/inboundfilters.ts index ac89c7d222c6..833169e33bd2 100644 --- a/packages/core/src/integrations/inboundfilters.ts +++ b/packages/core/src/integrations/inboundfilters.ts @@ -1,8 +1,8 @@ -import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types'; +import type { Event, IntegrationFn, StackFrame } from '@sentry/types'; import { getEventDescription, logger, stringMatchesSomePattern } from '@sentry/utils'; import { DEBUG_BUILD } from '../debug-build'; -import { convertIntegrationFnToClass, defineIntegration } from '../integration'; +import { defineIntegration } from '../integration'; // "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. @@ -36,28 +36,6 @@ const _inboundFiltersIntegration = ((options: Partial = { export const inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration); -/** - * Inbound filters configurable by the user. - * @deprecated Use `inboundFiltersIntegration()` instead. - */ -// eslint-disable-next-line deprecation/deprecation -export const InboundFilters = convertIntegrationFnToClass( - INTEGRATION_NAME, - inboundFiltersIntegration, -) as IntegrationClass void }> & { - new ( - options?: Partial<{ - allowUrls: Array; - denyUrls: Array; - ignoreErrors: Array; - ignoreTransactions: Array; - ignoreInternal: boolean; - disableErrorDefaults: boolean; - disableTransactionDefaults: boolean; - }>, - ): Integration; -}; - function _mergeOptions( internalOptions: Partial = {}, clientOptions: Partial = {}, diff --git a/packages/core/src/integrations/index.ts b/packages/core/src/integrations/index.ts deleted file mode 100644 index 7e2dc7fa5094..000000000000 --- a/packages/core/src/integrations/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable deprecation/deprecation */ -export { FunctionToString } from './functiontostring'; -export { InboundFilters } from './inboundfilters'; -export { LinkedErrors } from './linkederrors'; diff --git a/packages/core/src/integrations/linkederrors.ts b/packages/core/src/integrations/linkederrors.ts index b23eaf4272b0..d5d4d03f9e90 100644 --- a/packages/core/src/integrations/linkederrors.ts +++ b/packages/core/src/integrations/linkederrors.ts @@ -1,6 +1,6 @@ -import type { Client, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types'; +import type { IntegrationFn } from '@sentry/types'; import { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils'; -import { convertIntegrationFnToClass, defineIntegration } from '../integration'; +import { defineIntegration } from '../integration'; interface LinkedErrorsOptions { key?: string; @@ -35,12 +35,3 @@ const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => { }) satisfies IntegrationFn; export const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration); - -/** - * Adds SDK info to an event. - * @deprecated Use `linkedErrorsIntegration()` instead. - */ -// eslint-disable-next-line deprecation/deprecation -export const LinkedErrors = convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration) as IntegrationClass< - Integration & { preprocessEvent: (event: Event, hint: EventHint, client: Client) => void } -> & { new (options?: { key?: string; limit?: number }): Integration }; diff --git a/packages/core/test/lib/integrations/inboundfilters.test.ts b/packages/core/test/lib/integrations/inboundfilters.test.ts index f3c29b0398d2..72d553ce3dc2 100644 --- a/packages/core/test/lib/integrations/inboundfilters.test.ts +++ b/packages/core/test/lib/integrations/inboundfilters.test.ts @@ -1,7 +1,7 @@ import type { Event, EventProcessor } from '@sentry/types'; import type { InboundFiltersOptions } from '../../../src/integrations/inboundfilters'; -import { InboundFilters } from '../../../src/integrations/inboundfilters'; +import { inboundFiltersIntegration } from '../../../src/integrations/inboundfilters'; import { TestClient, getDefaultTestClientOptions } from '../../mocks/client'; const PUBLIC_DSN = 'https://username@domain/123'; @@ -33,8 +33,7 @@ function createInboundFiltersEventProcessor( dsn: PUBLIC_DSN, ...clientOptions, defaultIntegrations: false, - // eslint-disable-next-line deprecation/deprecation - integrations: [new InboundFilters(options)], + integrations: [inboundFiltersIntegration(options)], }), ); diff --git a/packages/deno/src/index.ts b/packages/deno/src/index.ts index 50a422f776ab..f0454031fe4a 100644 --- a/packages/deno/src/index.ts +++ b/packages/deno/src/index.ts @@ -95,8 +95,6 @@ export { init, } from './sdk'; -import { Integrations as CoreIntegrations } from '@sentry/core'; - export { denoContextIntegration } from './integrations/context'; export { globalHandlersIntegration } from './integrations/globalhandlers'; export { normalizePathsIntegration } from './integrations/normalizepaths'; @@ -108,7 +106,5 @@ import * as DenoIntegrations from './integrations'; /** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */ export const Integrations = { - // eslint-disable-next-line deprecation/deprecation - ...CoreIntegrations, ...DenoIntegrations, }; diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 8f4e1a9ee87c..ea2ec2ddb82c 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -102,16 +102,12 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from export { createGetModuleFromFilename } from './module'; -import { Integrations as CoreIntegrations } from '@sentry/core'; - import * as Handlers from './handlers'; import * as NodeIntegrations from './integrations'; import * as TracingIntegrations from './tracing/integrations'; // TODO: Deprecate this once we migrated tracing integrations export const Integrations = { - // eslint-disable-next-line deprecation/deprecation - ...CoreIntegrations, ...NodeIntegrations, ...TracingIntegrations, }; diff --git a/packages/node/src/integrations/contextlines.ts b/packages/node/src/integrations/contextlines.ts index 2f292a5606dc..7c367f51a970 100644 --- a/packages/node/src/integrations/contextlines.ts +++ b/packages/node/src/integrations/contextlines.ts @@ -1,6 +1,6 @@ import { readFile } from 'fs'; -import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core'; -import type { Event, Integration, IntegrationClass, IntegrationFn, StackFrame } from '@sentry/types'; +import { defineIntegration } from '@sentry/core'; +import type { Event, IntegrationFn, StackFrame } from '@sentry/types'; import { LRUMap, addContextToFrame } from '@sentry/utils'; const FILE_CONTENT_CACHE = new LRUMap(100); @@ -48,15 +48,6 @@ const _contextLinesIntegration = ((options: ContextLinesOptions = {}) => { export const contextLinesIntegration = defineIntegration(_contextLinesIntegration); -/** - * Add node modules / packages to the event. - * @deprecated Use `contextLinesIntegration()` instead. - */ -// eslint-disable-next-line deprecation/deprecation -export const ContextLines = convertIntegrationFnToClass(INTEGRATION_NAME, contextLinesIntegration) as IntegrationClass< - Integration & { processEvent: (event: Event) => Promise } -> & { new (options?: { frameContextLines?: number }): Integration }; - async function addSourceContext(event: Event, contextLines: number): Promise { // keep a lookup map of which files we've already enqueued to read, // so we don't enqueue the same file multiple times which would cause multiple i/o reads @@ -122,9 +113,6 @@ function addSourceContextToFrames(frames: StackFrame[], contextLines: number): v } } -// eslint-disable-next-line deprecation/deprecation -export type ContextLines = typeof ContextLines; - /** * Reads file contents and caches them in a global LRU cache. * If reading fails, mark the file as null in the cache so we don't try again. diff --git a/packages/node/src/integrations/index.ts b/packages/node/src/integrations/index.ts index 083df21bd68d..42cf53827542 100644 --- a/packages/node/src/integrations/index.ts +++ b/packages/node/src/integrations/index.ts @@ -4,7 +4,6 @@ export { Http } from './http'; export { OnUncaughtException } from './onuncaughtexception'; export { OnUnhandledRejection } from './onunhandledrejection'; export { Modules } from './modules'; -export { ContextLines } from './contextlines'; export { Context } from './context'; export { RequestData } from '@sentry/core'; export { Undici } from './undici'; diff --git a/packages/node/test/index.test.ts b/packages/node/test/index.test.ts index 563fa8886420..c6fc8a611aee 100644 --- a/packages/node/test/index.test.ts +++ b/packages/node/test/index.test.ts @@ -1,5 +1,4 @@ import { - LinkedErrors, SDK_VERSION, getGlobalScope, getIsolationScope, @@ -11,7 +10,7 @@ import { import type { EventHint, Integration } from '@sentry/types'; import type { Event } from '../src'; -import { contextLinesIntegration } from '../src'; +import { contextLinesIntegration, linkedErrorsIntegration } from '../src'; import { NodeClient, addBreadcrumb, @@ -24,7 +23,6 @@ import { init, } from '../src'; import { setNodeAsyncContextStrategy } from '../src/async'; -import { ContextLines } from '../src/integrations'; import { defaultStackParser, getDefaultIntegrations } from '../src/sdk'; import { getDefaultNodeClientOptions } from './helper/node-client-options'; @@ -217,8 +215,7 @@ describe('SentryNode', () => { expect.assertions(15); const options = getDefaultNodeClientOptions({ stackParser: defaultStackParser, - // eslint-disable-next-line deprecation/deprecation - integrations: [new ContextLines(), new LinkedErrors()], + integrations: [contextLinesIntegration(), linkedErrorsIntegration()], beforeSend: (event: Event) => { expect(event.exception).not.toBeUndefined(); expect(event.exception!.values![1]).not.toBeUndefined(); diff --git a/packages/node/test/integrations/contextlines.test.ts b/packages/node/test/integrations/contextlines.test.ts index dccc6c113b5f..dcc50f34c9a4 100644 --- a/packages/node/test/integrations/contextlines.test.ts +++ b/packages/node/test/integrations/contextlines.test.ts @@ -1,23 +1,25 @@ import * as fs from 'fs'; -import type { Event, Integration, StackFrame } from '@sentry/types'; +import type { Event, IntegrationFnResult, StackFrame } from '@sentry/types'; import { parseStackFrames } from '@sentry/utils'; -import { ContextLines, resetFileContentCache } from '../../src/integrations/contextlines'; +import { contextLinesIntegration } from '../../src'; +import { resetFileContentCache } from '../../src/integrations/contextlines'; import { defaultStackParser } from '../../src/sdk'; import { getError } from '../helper/error'; describe('ContextLines', () => { let readFileSpy: jest.SpyInstance; - let contextLines: Integration & { processEvent: (event: Event) => Promise }; + let contextLines: IntegrationFnResult; async function addContext(frames: StackFrame[]): Promise { - await contextLines.processEvent({ exception: { values: [{ stacktrace: { frames } }] } }); + await (contextLines as IntegrationFnResult & { processEvent: (event: Event) => Promise }).processEvent({ + exception: { values: [{ stacktrace: { frames } }] }, + }); } beforeEach(() => { readFileSpy = jest.spyOn(fs, 'readFile'); - // eslint-disable-next-line deprecation/deprecation - contextLines = new ContextLines(); + contextLines = contextLinesIntegration(); resetFileContentCache(); }); @@ -100,7 +102,7 @@ describe('ContextLines', () => { test('parseStack with no context', async () => { // eslint-disable-next-line deprecation/deprecation - contextLines = new ContextLines({ frameContextLines: 0 }); + contextLines = contextLinesIntegration({ frameContextLines: 0 }); expect.assertions(1); const frames = parseStackFrames(defaultStackParser, new Error('test')); @@ -113,7 +115,7 @@ describe('ContextLines', () => { test('does not attempt to readfile multiple times if it fails', async () => { expect.assertions(1); // eslint-disable-next-line deprecation/deprecation - contextLines = new ContextLines(); + contextLines = contextLinesIntegration(); readFileSpy.mockImplementation(() => { throw new Error("ENOENT: no such file or directory, open '/does/not/exist.js'"); diff --git a/packages/vercel-edge/src/index.ts b/packages/vercel-edge/src/index.ts index f09c61bdac90..6e5354d5831b 100644 --- a/packages/vercel-edge/src/index.ts +++ b/packages/vercel-edge/src/index.ts @@ -86,15 +86,13 @@ export { init, } from './sdk'; -import { Integrations as CoreIntegrations, RequestData } from '@sentry/core'; +import { RequestData } from '@sentry/core'; import { WinterCGFetch } from './integrations/wintercg-fetch'; export { winterCGFetchIntegration } from './integrations/wintercg-fetch'; /** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */ export const Integrations = { - // eslint-disable-next-line deprecation/deprecation - ...CoreIntegrations, WinterCGFetch, RequestData, }; From b01afcbb6601cc3af84ff6f85c2bffc1fd2e6e80 Mon Sep 17 00:00:00 2001 From: s1gr1d Date: Mon, 4 Mar 2024 09:52:39 +0100 Subject: [PATCH 2/2] fix tests --- .../suites/integrations/Breadcrumbs/dom/init.js | 2 +- .../suites/integrations/Breadcrumbs/fetch/init.js | 2 +- .../suites/integrations/Breadcrumbs/xhr/init.js | 2 +- packages/browser/test/unit/index.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js index 3cc53bd67d42..36806d01c6d0 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/init.js @@ -5,6 +5,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', defaultIntegrations: false, - integrations: [new Sentry.breadcrumbsIntegration()], + integrations: [Sentry.breadcrumbsIntegration()], sampleRate: 1, }); diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js index 3cc53bd67d42..36806d01c6d0 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/fetch/init.js @@ -5,6 +5,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', defaultIntegrations: false, - integrations: [new Sentry.breadcrumbsIntegration()], + integrations: [Sentry.breadcrumbsIntegration()], sampleRate: 1, }); diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js index 3cc53bd67d42..36806d01c6d0 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/xhr/init.js @@ -5,6 +5,6 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', defaultIntegrations: false, - integrations: [new Sentry.breadcrumbsIntegration()], + integrations: [Sentry.breadcrumbsIntegration()], sampleRate: 1, }); diff --git a/packages/browser/test/unit/index.test.ts b/packages/browser/test/unit/index.test.ts index 7ae117ba85a1..19d8f570f9e6 100644 --- a/packages/browser/test/unit/index.test.ts +++ b/packages/browser/test/unit/index.test.ts @@ -270,7 +270,7 @@ describe('SentryBrowser', () => { expect(localBeforeSend).toHaveBeenCalledTimes(2); }); - il; + it('should use inboundfilter rules of bound client', async () => { const localBeforeSend = jest.fn(); const options = getDefaultBrowserClientOptions({