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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Features

- Adds GraphQL integration ([#5299](https://github.com/getsentry/sentry-react-native/pull/5299))
- Adds Supabase integration ([#5296](https://github.com/getsentry/sentry-react-native/pull/5296))

### Dependencies

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/integrations/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export { breadcrumbsIntegration } from './breadcrumbs';
export { primitiveTagIntegration } from './primitiveTagIntegration';
export { logEnricherIntegration } from './logEnricherIntegration';
export { graphqlIntegration } from './graphql';
export { supabaseIntegration } from './supabase';

export {
browserApiErrorsIntegration,
Expand Down
15 changes: 15 additions & 0 deletions packages/core/src/js/integrations/supabase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { supabaseIntegration as browserSupabaseIntegration } from '@sentry/browser';
import type { Integration } from '@sentry/core';

type SupabaseReactNativeIntegrationOptions = {
supabaseClient: unknown;
};

/**
* Use this integration to instrument your Supabase client.
*
* Learn more about Supabase at https://supabase.com
*/
export function supabaseIntegration(options: SupabaseReactNativeIntegrationOptions): Integration {
return browserSupabaseIntegration({ supabaseClient: options.supabaseClient });
}
29 changes: 29 additions & 0 deletions packages/core/test/integrations/supabase.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { supabaseIntegration as browserSupabaseIntegration } from '@sentry/browser';
import { supabaseIntegration } from '../../src/js';

jest.mock('@sentry/browser', () => ({
supabaseIntegration: jest.fn(),
}));

function createMockClient() {
return {
init: jest.fn(),
};
}

describe('supabase', () => {
afterEach(() => {
jest.resetAllMocks();
});

// this test is sufficient to test the integration because everything else
// is covered by the integration tests in the @sentry/browser package
it('passes React Native options to browserSupabaseIntegration', () => {
const mockClient = createMockClient();
supabaseIntegration({ supabaseClient: mockClient });

expect(browserSupabaseIntegration).toHaveBeenCalledWith({
supabaseClient: mockClient,
});
});
});
Loading