Skip to content

Commit a04a2f9

Browse files
committed
build: Run yarn-deduplicate
1 parent ab7c2f8 commit a04a2f9

File tree

2 files changed

+223
-2379
lines changed

2 files changed

+223
-2379
lines changed

packages/svelte/test/sdk.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
import { addGlobalEventProcessor, init as browserInitRaw, SDK_VERSION } from '@sentry/browser';
1+
import { addGlobalEventProcessor, init as browserInit, SDK_VERSION } from '@sentry/browser';
22
import { EventProcessor } from '@sentry/types';
33

44
import { detectAndReportSvelteKit, init as svelteInit, isSvelteKitApp } from '../src/sdk';
55

6-
const browserInit = browserInitRaw as jest.Mock;
7-
const addGlobalEventProcessorFunction = addGlobalEventProcessor as jest.Mock;
86
let passedEventProcessor: EventProcessor | undefined;
9-
addGlobalEventProcessorFunction.mockImplementation(proc => {
10-
passedEventProcessor = proc;
11-
});
127

13-
jest.mock('@sentry/browser');
8+
jest.mock('@sentry/browser', () => {
9+
const actual = jest.requireActual('@sentry/browser');
10+
return {
11+
...actual,
12+
init: jest.fn().mockImplementation(actual.init),
13+
addGlobalEventProcessor: jest.fn().mockImplementation(proc => {
14+
passedEventProcessor = proc;
15+
}),
16+
};
17+
});
1418

1519
describe('Initialize Svelte SDk', () => {
1620
afterAll(() => {
@@ -48,7 +52,7 @@ describe('detectAndReportSvelteKit()', () => {
4852
it('registers a global event processor', async () => {
4953
detectAndReportSvelteKit();
5054

51-
expect(addGlobalEventProcessorFunction).toHaveBeenCalledTimes(1);
55+
expect(addGlobalEventProcessor).toHaveBeenCalledTimes(1);
5256
expect(passedEventProcessor?.id).toEqual('svelteKitProcessor');
5357
});
5458

0 commit comments

Comments
 (0)