diff --git a/packages/nuxt/src/server/sdk.ts b/packages/nuxt/src/server/sdk.ts index 2621f3f77f9a..3be024815b4c 100644 --- a/packages/nuxt/src/server/sdk.ts +++ b/packages/nuxt/src/server/sdk.ts @@ -27,8 +27,8 @@ import type { SentryNuxtServerOptions } from '../common/types'; export function init(options: SentryNuxtServerOptions): Client | undefined { const sentryOptions = { environment: !isCjs() && import.meta.dev ? DEV_ENVIRONMENT : DEFAULT_ENVIRONMENT, - ...options, defaultIntegrations: getNuxtDefaultIntegrations(options), + ...options, }; applySdkMetadata(sentryOptions, 'nuxt', ['nuxt', 'node']); diff --git a/packages/nuxt/test/client/sdk.test.ts b/packages/nuxt/test/client/sdk.test.ts index 29448c720ea4..833872069e4e 100644 --- a/packages/nuxt/test/client/sdk.test.ts +++ b/packages/nuxt/test/client/sdk.test.ts @@ -41,5 +41,41 @@ describe('Nuxt Client SDK', () => { it('returns client from init', () => { expect(init({})).not.toBeUndefined(); }); + + it('uses default integrations when not provided in options', () => { + init({ dsn: 'https://public@dsn.ingest.sentry.io/1337' }); + + expect(browserInit).toHaveBeenCalledTimes(1); + const callArgs = browserInit.mock.calls[0]?.[0]; + expect(callArgs).toBeDefined(); + expect(callArgs?.defaultIntegrations).toBeDefined(); + expect(Array.isArray(callArgs?.defaultIntegrations)).toBe(true); + }); + + it('allows options.defaultIntegrations to override default integrations', () => { + const customIntegrations = [{ name: 'CustomIntegration' }]; + + init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + defaultIntegrations: customIntegrations as any, + }); + + expect(browserInit).toHaveBeenCalledTimes(1); + const callArgs = browserInit.mock.calls[0]?.[0]; + expect(callArgs).toBeDefined(); + expect(callArgs?.defaultIntegrations).toBe(customIntegrations); + }); + + it('allows options.defaultIntegrations to be set to false', () => { + init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + defaultIntegrations: false, + }); + + expect(browserInit).toHaveBeenCalledTimes(1); + const callArgs = browserInit.mock.calls[0]?.[0]; + expect(callArgs).toBeDefined(); + expect(callArgs?.defaultIntegrations).toBe(false); + }); }); }); diff --git a/packages/nuxt/test/server/sdk.test.ts b/packages/nuxt/test/server/sdk.test.ts index 626b574612b0..c2565217d138 100644 --- a/packages/nuxt/test/server/sdk.test.ts +++ b/packages/nuxt/test/server/sdk.test.ts @@ -41,6 +41,42 @@ describe('Nuxt Server SDK', () => { expect(init({})).not.toBeUndefined(); }); + it('uses default integrations when not provided in options', () => { + init({ dsn: 'https://public@dsn.ingest.sentry.io/1337' }); + + expect(nodeInit).toHaveBeenCalledTimes(1); + const callArgs = nodeInit.mock.calls[0]?.[0]; + expect(callArgs).toBeDefined(); + expect(callArgs?.defaultIntegrations).toBeDefined(); + expect(Array.isArray(callArgs?.defaultIntegrations)).toBe(true); + }); + + it('allows options.defaultIntegrations to override default integrations', () => { + const customIntegrations = [{ name: 'CustomIntegration' }]; + + init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + defaultIntegrations: customIntegrations as any, + }); + + expect(nodeInit).toHaveBeenCalledTimes(1); + const callArgs = nodeInit.mock.calls[0]?.[0]; + expect(callArgs).toBeDefined(); + expect(callArgs?.defaultIntegrations).toBe(customIntegrations); + }); + + it('allows options.defaultIntegrations to be set to false', () => { + init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + defaultIntegrations: false, + }); + + expect(nodeInit).toHaveBeenCalledTimes(1); + const callArgs = nodeInit.mock.calls[0]?.[0]; + expect(callArgs).toBeDefined(); + expect(callArgs?.defaultIntegrations).toBe(false); + }); + describe('lowQualityTransactionsFilter', () => { const options = { debug: false }; const filter = lowQualityTransactionsFilter(options);