From 5e0cef0b91786dceda56ff5fbbdfad5daff66fe7 Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Sun, 22 Dec 2024 10:06:30 +0100 Subject: [PATCH] fix tests --- packages/_server/src/utils/catchPromise.test.mts | 6 +++--- vitest.config.mts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/_server/src/utils/catchPromise.test.mts b/packages/_server/src/utils/catchPromise.test.mts index 32f4d70647..6c5af10759 100644 --- a/packages/_server/src/utils/catchPromise.test.mts +++ b/packages/_server/src/utils/catchPromise.test.mts @@ -16,18 +16,18 @@ describe('catchPromise', () => { test('catchPromise with context', async () => { const err = vi.spyOn(console, 'error').mockImplementation(() => undefined); await expect(catchPromise(Promise.reject(Error('test')), 'Testing')).resolves.toBe(undefined); - expect(err).toHaveBeenCalledWith('%s: %s', 'Testing', expect.any(Error)); + expect(err).toHaveBeenCalledWith(expect.stringContaining(`Testing: `)); }); test('catchPromise custom handler', async () => { const err = vi.spyOn(console, 'error').mockImplementation(() => undefined); - await expect(catchPromise(Promise.reject('error'), () => 23)).resolves.toBe(23); + await expect(catchPromise(Promise.reject('error'), () => 23)).resolves.toBe(undefined); expect(err).not.toHaveBeenCalled(); }); test('catchPromise resolve', async () => { const err = vi.spyOn(console, 'error').mockImplementation(() => undefined); - await expect(catchPromise(Promise.resolve('msg'))).resolves.toBe('msg'); + await expect(catchPromise(Promise.resolve('msg'))).resolves.toBe(undefined); expect(err).not.toHaveBeenCalled(); }); }); diff --git a/vitest.config.mts b/vitest.config.mts index d692adb319..1835fa8e0b 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -7,6 +7,7 @@ export default defineConfig({ exclude: [ '**/node_modules/**', '**/dist/**', + '**/lib/**/*.{cjs,mjs,js}', '**/cypress/**', '**/coverage/**', '**/temp/**',