Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
Severity,
Status,
} from '@sentry/types';
import { getGlobalObject, uuid4 } from '@sentry/utils/misc';
import { forget } from '@sentry/utils/async';
import { getGlobalObject, uuid4 } from '@sentry/utils/misc';
import { truncate } from '@sentry/utils/string';
import { BackendClass } from './basebackend';
import { Dsn } from './dsn';
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export interface Options {
*/
dsn?: string;

/**
* If this is set to false, default integrations will not be added.
*/
defaultIntegrations?: boolean;

/**
* List of integrations that should be installed after SDK was initialized.
* Accepts either a list of integrations or a function that receives
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function initAndBind<F extends Client, O extends Options>(
// there needs to be a client on the hub already.
getCurrentHub().bindClient(client);

let integrations = [...defaultIntegrations];
let integrations = options.defaultIntegrations === false ? [] : [...defaultIntegrations];
if (Array.isArray(options.integrations)) {
const providedIntegrationsNames = options.integrations.map(i => i.name);
integrations = [
Expand Down
10 changes: 10 additions & 0 deletions packages/core/test/lib/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ describe('SDK', () => {
expect(DEFAULT_INTEGRATIONS[1].handler.mock.calls.length).toBe(1);
});

test('not installs default integrations', () => {
const DEFAULT_INTEGRATIONS: Integration[] = [
new MockIntegration('MockIntegration 1'),
new MockIntegration('MockIntegration 2'),
];
initAndBind(TestClient, { defaultIntegrations: false }, DEFAULT_INTEGRATIONS);
expect(DEFAULT_INTEGRATIONS[0].handler.mock.calls.length).toBe(0);
expect(DEFAULT_INTEGRATIONS[1].handler.mock.calls.length).toBe(0);
});

test('installs integrations provided through options', () => {
const integrations: Integration[] = [
new MockIntegration('MockIntegration 1'),
Expand Down