Skip to content

Commit 87ffe2e

Browse files
committed
feat(solidjs): Avoid leaking vi mocks across tests
1 parent 33752e5 commit 87ffe2e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

packages/astro/test/client/sdk.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import {
88
} from '@sentry/browser';
99
import * as SentryBrowser from '@sentry/browser';
1010
import { SDK_VERSION, getClient } from '@sentry/browser';
11-
import { vi } from 'vitest';
1211

12+
import { vi } from 'vitest';
1313
import { init } from '../../../astro/src/client/sdk';
1414

15-
const browserInit = vi.spyOn(SentryBrowser, 'init');
16-
1715
describe('Sentry client SDK', () => {
1816
describe('init', () => {
17+
const browserInit = vi.spyOn(SentryBrowser, 'init');
18+
1919
afterEach(() => {
2020
vi.clearAllMocks();
2121

packages/solidjs/test/sdk.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import * as SentryBrowser from '@sentry/browser';
44
import { vi } from 'vitest';
55
import { init as solidInit } from '../src/sdk';
66

7-
const browserInit = vi.spyOn(SentryBrowser, 'init');
8-
97
describe('Initialize SolidJS SDk', () => {
8+
const browserInit = vi.spyOn(SentryBrowser, 'init');
9+
1010
beforeEach(() => {
1111
vi.clearAllMocks();
1212
});

packages/svelte/test/sdk.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,9 @@ import { detectAndReportSvelteKit, init as svelteInit, isSvelteKitApp } from '..
77

88
let passedEventProcessor: EventProcessor | undefined;
99

10-
const browserInit = vi.spyOn(SentryBrowser, 'init');
11-
const addEventProcessor = vi
12-
.spyOn(SentryBrowser, 'addEventProcessor')
13-
.mockImplementation((eventProcessor: EventProcessor) => {
14-
passedEventProcessor = eventProcessor;
15-
return () => {};
16-
});
17-
1810
describe('Initialize Svelte SDk', () => {
11+
const browserInit = vi.spyOn(SentryBrowser, 'init');
12+
1913
beforeEach(() => {
2014
vi.clearAllMocks();
2115
});
@@ -73,6 +67,12 @@ describe('Initialize Svelte SDk', () => {
7367
});
7468

7569
describe('detectAndReportSvelteKit()', () => {
70+
const addEventProcessor = vi
71+
.spyOn(SentryBrowser, 'addEventProcessor')
72+
.mockImplementation((eventProcessor: EventProcessor) => {
73+
passedEventProcessor = eventProcessor;
74+
return () => {};
75+
});
7676
const originalHtmlBody = document.body.innerHTML;
7777
beforeEach(() => {
7878
vi.clearAllMocks();

0 commit comments

Comments
 (0)