diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe9d81770..b537c28eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ ### Fixes - Change log output to show what paths are considered when collecting modules ([#3316](https://github.com/getsentry/sentry-react-native/pull/3316)) +- Should not take screenshot when SDK is disabled ([#3328](https://github.com/getsentry/sentry-react-native/pull/3328)) ### Dependencies diff --git a/test/sdk.test.ts b/test/sdk.test.ts index 00ebd6eeb1..c77b8e97cd 100644 --- a/test/sdk.test.ts +++ b/test/sdk.test.ts @@ -440,6 +440,7 @@ describe('Tests the SDK functionality', () => { it('adds screenshot integration', () => { init({ attachScreenshot: true, + enabled: true, }); const actualOptions = mockedInitAndBind.mock.calls[0][secondArg] as ReactNativeClientOptions; @@ -448,6 +449,18 @@ describe('Tests the SDK functionality', () => { expect(actualIntegrations).toEqual(expect.arrayContaining([expect.objectContaining({ name: 'Screenshot' })])); }); + it('Should not add screenshot integration when the SDK is disabled', () => { + init({ + attachScreenshot: true, + enabled: false, + }); + + const actualOptions = mockedInitAndBind.mock.calls[0][secondArg] as ReactNativeClientOptions; + const actualIntegrations = actualOptions.integrations; + + expect(actualIntegrations).not.toEqual(expect.arrayContaining([expect.objectContaining({ name: 'Screenshot' })])); + }); + it('no view hierarchy integration by default', () => { init({});