Skip to content

Commit f83d4f6

Browse files
committed
fix gatsby tests
1 parent f639467 commit f83d4f6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/gatsby/test/sdk.test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
import { init as reactInitRaw, SDK_VERSION } from '@sentry/react';
1+
import { init, SDK_VERSION } from '@sentry/react';
22
import { Integrations } from '@sentry/tracing';
33
import { Integration } from '@sentry/types';
44

55
import { init as gatsbyInit } from '../src/sdk';
66
import { UserIntegrations } from '../src/utils/integrations';
77
import { GatsbyOptions } from '../src/utils/types';
88

9-
const reactInit = reactInitRaw as jest.Mock;
10-
jest.mock('@sentry/react');
9+
jest.mock('@sentry/react', () => {
10+
const actual = jest.requireActual('@sentry/react');
11+
return {
12+
...actual,
13+
init: jest.fn().mockImplementation(actual.init),
14+
};
15+
});
16+
17+
const reactInit = init as jest.Mock;
1118

1219
describe('Initialize React SDK', () => {
1320
afterEach(() => reactInit.mockReset());

0 commit comments

Comments
 (0)