From d9ff362490770aa99150610c01f710c967ebbc61 Mon Sep 17 00:00:00 2001 From: ahnpnl Date: Mon, 19 Aug 2024 22:44:26 +0200 Subject: [PATCH] fix: set value `ts/tsx` `extensionsToTreatAsEsm` in default esm preset --- src/presets/__snapshots__/create-jest-preset.spec.ts.snap | 2 -- src/presets/create-jest-preset.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/presets/__snapshots__/create-jest-preset.spec.ts.snap b/src/presets/__snapshots__/create-jest-preset.spec.ts.snap index 527a6e53cf..d21e6e47b8 100644 --- a/src/presets/__snapshots__/create-jest-preset.spec.ts.snap +++ b/src/presets/__snapshots__/create-jest-preset.spec.ts.snap @@ -91,7 +91,6 @@ exports[`create-jest-preset CJS presets createJsWithTsPreset should return prese exports[`create-jest-preset ESM presets createDefaultEsmLegacyPreset should return preset config 1`] = ` { "extensionsToTreatAsEsm": [ - ".jsx", ".ts", ".tsx", ".mts", @@ -111,7 +110,6 @@ exports[`create-jest-preset ESM presets createDefaultEsmLegacyPreset should retu exports[`create-jest-preset ESM presets createDefaultEsmPreset should return preset config 1`] = ` { "extensionsToTreatAsEsm": [ - ".jsx", ".ts", ".tsx", ".mts", diff --git a/src/presets/create-jest-preset.ts b/src/presets/create-jest-preset.ts index f0a5cd755a..1fe265d33c 100644 --- a/src/presets/create-jest-preset.ts +++ b/src/presets/create-jest-preset.ts @@ -133,7 +133,7 @@ export function createDefaultEsmPreset(tsJestTransformOptions: DefaultEsmTransfo logger.debug('creating default ESM Jest preset') return { - extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], + extensionsToTreatAsEsm: [...TS_EXT_TO_TREAT_AS_ESM], transform: { [ESM_TS_TRANSFORM_PATTERN]: [ 'ts-jest', @@ -152,7 +152,7 @@ export function createDefaultEsmLegacyPreset( logger.debug('creating default ESM Jest preset') return { - extensionsToTreatAsEsm: [...JS_EXT_TO_TREAT_AS_ESM, ...TS_EXT_TO_TREAT_AS_ESM], + extensionsToTreatAsEsm: [...TS_EXT_TO_TREAT_AS_ESM], transform: { [ESM_TS_TRANSFORM_PATTERN]: [ 'ts-jest/legacy',