Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Sep 11, 2024
1 parent 460c280 commit c71b5c1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/sveltekit/test/vite/sourceMaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ vi.mock('@sentry/vite-plugin', async () => {
};
});

vi.mock('sorcery', async () => {
return {
load: vi.fn().mockResolvedValue({
apply: vi.fn().mockResolvedValue(undefined),
write: vi.fn().mockResolvedValue(undefined),
}),
};
});

beforeEach(() => {
vi.clearAllMocks();
});
Expand Down Expand Up @@ -79,7 +88,7 @@ describe('makeCustomSentryVitePlugin()', () => {
// @ts-expect-error this function exists!
plugin.configResolved({ build: { ssr: true } });
// @ts-expect-error this function exists!
plugin.closeBundle();
await plugin.closeBundle();
expect(mockedSentryVitePlugin.writeBundle).toHaveBeenCalledTimes(1);
});

Expand All @@ -89,7 +98,7 @@ describe('makeCustomSentryVitePlugin()', () => {
// @ts-expect-error this function exists!
plugin.configResolved({ build: { ssr: false } });
// @ts-expect-error this function exists!
plugin.closeBundle();
await plugin.closeBundle();
expect(mockedSentryVitePlugin.writeBundle).not.toHaveBeenCalled();
});
});
Expand All @@ -110,7 +119,7 @@ describe('makeCustomSentryVitePlugin()', () => {
// @ts-expect-error this function exists!
plugin.configResolved({ build: { ssr: true } });
// @ts-expect-error this function exists!
plugin.closeBundle();
await plugin.closeBundle();

expect(consoleWarnSpy).toHaveBeenCalledWith(expect.stringContaining('Failed to upload source maps'));
expect(consoleLogSpy).toHaveBeenCalled();
Expand Down

0 comments on commit c71b5c1

Please sign in to comment.