From f1f25f1bd921daf585033ac43ddbca1f32c9aafb Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Wed, 30 Oct 2024 18:33:05 +0000 Subject: [PATCH 1/2] fix: use file extension to avoid import errors for vitest and jest wrappers --- packages/jest/src/index.ts | 2 +- packages/vitest/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jest/src/index.ts b/packages/jest/src/index.ts index 1b95a531..ddda7c9e 100644 --- a/packages/jest/src/index.ts +++ b/packages/jest/src/index.ts @@ -3,7 +3,7 @@ import { defaultFetchMockConfig, RemoveRouteOptions, } from 'fetch-mock'; -import './jest-extensions'; +import './jest-extensions.js'; import type { Jest } from '@jest/environment'; type MockResetOptions = { diff --git a/packages/vitest/src/index.ts b/packages/vitest/src/index.ts index 9ef977f5..0c779968 100644 --- a/packages/vitest/src/index.ts +++ b/packages/vitest/src/index.ts @@ -4,7 +4,7 @@ import { defaultFetchMockConfig, RemoveRouteOptions, } from 'fetch-mock'; -import './vitest-extensions'; +import './vitest-extensions.js'; type MockResetOptions = { includeSticky: boolean; From 16e96a1b9747d9128a5a436c0db59592984a2258 Mon Sep 17 00:00:00 2001 From: Rhys Evans Date: Wed, 30 Oct 2024 18:40:50 +0000 Subject: [PATCH 2/2] test: fix jest tests by mapping .js to an extensionless reference, which means .ts will be found --- jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.js b/jest.config.js index ec9282ea..4acff3b1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,5 +6,6 @@ export default { }, moduleNameMapper: { '@fetch-mock/core': '/packages/core/dist/cjs/index.js', + '(.+)\\.js': '$1', }, };