From 0e34b7af80c7ed1887c51089e457585e04367cac Mon Sep 17 00:00:00 2001 From: ahnpnl Date: Tue, 9 Jul 2024 17:11:07 +0200 Subject: [PATCH] test(examples): use preset util functions in all example projects --- .../jest-esm-isolated.config.mjs | 19 +++++---------- examples/js-with-babel/jest-esm.config.mjs | 17 ++++---------- .../js-with-babel/jest-isolated.config.cjs | 16 ++++--------- examples/js-with-babel/jest.config.cjs | 13 ++++------- .../js-with-ts/jest-esm-isolated.config.mjs | 17 ++++---------- examples/js-with-ts/jest-esm.config.mjs | 15 ++++-------- examples/js-with-ts/jest-isolated.config.cjs | 14 ++++------- examples/js-with-ts/jest.config.cjs | 4 ++-- .../project-1/jest-esm-isolated.config.mjs | 17 ++++---------- .../tests/project-1/jest-esm.config.mjs | 15 ++++-------- .../tests/project-1/jest-isolated.config.cjs | 14 ++++------- .../tests/project-1/jest.config.cjs | 4 ++-- .../project-2/jest-esm-isolated.config.mjs | 17 ++++---------- .../tests/project-2/jest-esm.config.mjs | 15 ++++-------- .../tests/project-2/jest-isolated.config.cjs | 14 ++++------- .../tests/project-2/jest.config.cjs | 4 ++-- .../react-app/jest-esm-isolated.config.mjs | 23 ++++++++++--------- examples/react-app/jest-esm.config.mjs | 22 +++++++++--------- examples/react-app/jest-isolated.config.cjs | 14 +++++------ examples/react-app/jest.config.cjs | 15 ++++++------ examples/ts-only/jest-esm-isolated.config.mjs | 18 +++++---------- examples/ts-only/jest-esm.config.mjs | 16 ++++--------- examples/ts-only/jest-isolated.config.cjs | 14 ++++------- examples/ts-only/jest.config.cjs | 4 ++-- .../type-module/jest-esm-isolated.config.js | 17 ++++---------- examples/type-module/jest-esm.config.js | 15 ++++-------- examples/type-module/jest-isolated.config.js | 14 ++++------- examples/type-module/jest.config.js | 4 ++-- 28 files changed, 135 insertions(+), 256 deletions(-) diff --git a/examples/js-with-babel/jest-esm-isolated.config.mjs b/examples/js-with-babel/jest-esm-isolated.config.mjs index 41132b8678..5b9dd38f86 100644 --- a/examples/js-with-babel/jest-esm-isolated.config.mjs +++ b/examples/js-with-babel/jest-esm-isolated.config.mjs @@ -1,17 +1,10 @@ -import preset from 'ts-jest/presets/index.js' +import { createJsWithBabelEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.jsWithBabelESM, - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - babelConfig: true, - isolatedModules: true, - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createJsWithBabelEsmPreset({ + babelConfig: true, + tsconfig: 'tsconfig-esm.json', + isolatedModules: true, + }) } diff --git a/examples/js-with-babel/jest-esm.config.mjs b/examples/js-with-babel/jest-esm.config.mjs index 3cb4b4fb7a..8d8c29687f 100644 --- a/examples/js-with-babel/jest-esm.config.mjs +++ b/examples/js-with-babel/jest-esm.config.mjs @@ -1,16 +1,9 @@ -import preset from 'ts-jest/presets/index.js' +import { createJsWithBabelEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.jsWithBabelESM, - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - babelConfig: true, - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createJsWithBabelEsmPreset({ + babelConfig: true, + tsconfig: 'tsconfig-esm.json' + }) } diff --git a/examples/js-with-babel/jest-isolated.config.cjs b/examples/js-with-babel/jest-isolated.config.cjs index 90d06322ec..fb36fef0c7 100644 --- a/examples/js-with-babel/jest-isolated.config.cjs +++ b/examples/js-with-babel/jest-isolated.config.cjs @@ -1,15 +1,9 @@ -const preset = require('ts-jest/presets') +const { createJsWithBabelPreset } = require('ts-jest') /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.jsWithBabel, - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - babelConfig: true, - isolatedModules: true, - }, - ], - }, + ...createJsWithBabelPreset({ + babelConfig: true, + isolatedModules: true, + }) } diff --git a/examples/js-with-babel/jest.config.cjs b/examples/js-with-babel/jest.config.cjs index d2f89337ec..eeabf4f976 100644 --- a/examples/js-with-babel/jest.config.cjs +++ b/examples/js-with-babel/jest.config.cjs @@ -1,11 +1,8 @@ +const { createJsWithBabelPreset } = require('ts-jest') + /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - babelConfig: true, - }, - ], - }, + ...createJsWithBabelPreset({ + babelConfig: true, + }) } diff --git a/examples/js-with-ts/jest-esm-isolated.config.mjs b/examples/js-with-ts/jest-esm-isolated.config.mjs index 6fa28a1e31..787d03680c 100644 --- a/examples/js-with-ts/jest-esm-isolated.config.mjs +++ b/examples/js-with-ts/jest-esm-isolated.config.mjs @@ -1,16 +1,9 @@ -import preset from 'ts-jest/presets/index.js' +import { createJsWithTsPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.jsWithTsESM, - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createJsWithTsPreset({ + tsconfig: 'tsconfig-esm.json', + isolatedModules: true, + }) } diff --git a/examples/js-with-ts/jest-esm.config.mjs b/examples/js-with-ts/jest-esm.config.mjs index 13023d4854..9a545fe1f8 100644 --- a/examples/js-with-ts/jest-esm.config.mjs +++ b/examples/js-with-ts/jest-esm.config.mjs @@ -1,15 +1,8 @@ -import preset from 'ts-jest/presets/index.js' +import { createJsWithTsPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.jsWithTsESM, - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createJsWithTsPreset({ + tsconfig: 'tsconfig-esm.json' + }) } diff --git a/examples/js-with-ts/jest-isolated.config.cjs b/examples/js-with-ts/jest-isolated.config.cjs index 3e72dca833..1c52be5388 100644 --- a/examples/js-with-ts/jest-isolated.config.cjs +++ b/examples/js-with-ts/jest-isolated.config.cjs @@ -1,14 +1,8 @@ -const preset = require('ts-jest/presets') +const { createJsWithTsPreset } = require('ts-jest') /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.jsWithTs, - transform: { - '^.+\.[tj]sx?$': [ - 'ts-jest', - { - isolatedModules: true, - }, - ], - }, + ...createJsWithTsPreset({ + isolatedModules: true, + }) } diff --git a/examples/js-with-ts/jest.config.cjs b/examples/js-with-ts/jest.config.cjs index 935cce761f..3946d85343 100644 --- a/examples/js-with-ts/jest.config.cjs +++ b/examples/js-with-ts/jest.config.cjs @@ -1,6 +1,6 @@ -const preset = require('ts-jest/presets') +const { createJsWithTsPreset } = require('ts-jest') /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.jsWithTs, + ...createJsWithTsPreset() } diff --git a/examples/monorepo-app/tests/project-1/jest-esm-isolated.config.mjs b/examples/monorepo-app/tests/project-1/jest-esm-isolated.config.mjs index 46267237cd..4f63cd8b0a 100644 --- a/examples/monorepo-app/tests/project-1/jest-esm-isolated.config.mjs +++ b/examples/monorepo-app/tests/project-1/jest-esm-isolated.config.mjs @@ -1,16 +1,9 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tests/project-1/tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tests/project-1/tsconfig-esm.json', + isolatedModules: true, + }) } diff --git a/examples/monorepo-app/tests/project-1/jest-esm.config.mjs b/examples/monorepo-app/tests/project-1/jest-esm.config.mjs index 1d0c5fb8a3..a56858afa6 100644 --- a/examples/monorepo-app/tests/project-1/jest-esm.config.mjs +++ b/examples/monorepo-app/tests/project-1/jest-esm.config.mjs @@ -1,15 +1,8 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - tsconfig: 'tests/project-1/tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tests/project-1/tsconfig-esm.json', + }) } diff --git a/examples/monorepo-app/tests/project-1/jest-isolated.config.cjs b/examples/monorepo-app/tests/project-1/jest-isolated.config.cjs index 08ba2ebaca..9a0cff0afe 100644 --- a/examples/monorepo-app/tests/project-1/jest-isolated.config.cjs +++ b/examples/monorepo-app/tests/project-1/jest-isolated.config.cjs @@ -1,14 +1,8 @@ -const preset = require('ts-jest/presets'); +const { createDefaultPreset } = require('ts-jest'); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.defaults, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - }, - ], - }, + ...createDefaultPreset({ + isolatedModules: true, + }) } diff --git a/examples/monorepo-app/tests/project-1/jest.config.cjs b/examples/monorepo-app/tests/project-1/jest.config.cjs index c09314495e..862240b2d1 100644 --- a/examples/monorepo-app/tests/project-1/jest.config.cjs +++ b/examples/monorepo-app/tests/project-1/jest.config.cjs @@ -1,6 +1,6 @@ -const preset = require('ts-jest/presets'); +const { createDefaultPreset } = require('ts-jest'); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.defaults, + ...createDefaultPreset() } diff --git a/examples/monorepo-app/tests/project-2/jest-esm-isolated.config.mjs b/examples/monorepo-app/tests/project-2/jest-esm-isolated.config.mjs index 9dc7089b1f..400e69a0ce 100644 --- a/examples/monorepo-app/tests/project-2/jest-esm-isolated.config.mjs +++ b/examples/monorepo-app/tests/project-2/jest-esm-isolated.config.mjs @@ -1,16 +1,9 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tests/project-2/tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tests/project-2/tsconfig-esm.json', + isolatedModules: true, + }) } diff --git a/examples/monorepo-app/tests/project-2/jest-esm.config.mjs b/examples/monorepo-app/tests/project-2/jest-esm.config.mjs index 9296e8e528..51ca165e2c 100644 --- a/examples/monorepo-app/tests/project-2/jest-esm.config.mjs +++ b/examples/monorepo-app/tests/project-2/jest-esm.config.mjs @@ -1,15 +1,8 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - tsconfig: 'tests/project-2/tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tests/project-2/tsconfig-esm.json', + }) } diff --git a/examples/monorepo-app/tests/project-2/jest-isolated.config.cjs b/examples/monorepo-app/tests/project-2/jest-isolated.config.cjs index 08ba2ebaca..9a0cff0afe 100644 --- a/examples/monorepo-app/tests/project-2/jest-isolated.config.cjs +++ b/examples/monorepo-app/tests/project-2/jest-isolated.config.cjs @@ -1,14 +1,8 @@ -const preset = require('ts-jest/presets'); +const { createDefaultPreset } = require('ts-jest'); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.defaults, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - }, - ], - }, + ...createDefaultPreset({ + isolatedModules: true, + }) } diff --git a/examples/monorepo-app/tests/project-2/jest.config.cjs b/examples/monorepo-app/tests/project-2/jest.config.cjs index c09314495e..862240b2d1 100644 --- a/examples/monorepo-app/tests/project-2/jest.config.cjs +++ b/examples/monorepo-app/tests/project-2/jest.config.cjs @@ -1,6 +1,6 @@ -const preset = require('ts-jest/presets'); +const { createDefaultPreset } = require('ts-jest'); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.defaults, + ...createDefaultPreset() } diff --git a/examples/react-app/jest-esm-isolated.config.mjs b/examples/react-app/jest-esm-isolated.config.mjs index 68fa3089d2..559e288747 100644 --- a/examples/react-app/jest-esm-isolated.config.mjs +++ b/examples/react-app/jest-esm-isolated.config.mjs @@ -1,17 +1,18 @@ -import baseEsmCfg from './jest-esm.config.mjs' +import { createDefaultEsmPreset } from 'ts-jest' + +const defaultPreset = createDefaultEsmPreset({ + tsconfig: 'tsconfig-esm.spec.json', + isolatedModules: true, +}) /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...baseEsmCfg, + ...defaultPreset, + setupFilesAfterEnv: ['/src/setupTests.ts'], + testEnvironment: 'jsdom', transform: { - ...baseEsmCfg.transform, - '^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tsconfig-esm.spec.json', - useESM: true, - }, - ], + ...defaultPreset.transform, + '^.+\\.css$': '/config/jest/cssTransform.js', + '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '/config/jest/fileTransform.js', }, } diff --git a/examples/react-app/jest-esm.config.mjs b/examples/react-app/jest-esm.config.mjs index bf77ebaf01..711381571a 100644 --- a/examples/react-app/jest-esm.config.mjs +++ b/examples/react-app/jest-esm.config.mjs @@ -1,17 +1,17 @@ -import baseCfg from './jest.config.cjs' +import { createDefaultEsmPreset } from 'ts-jest' + +const defaultPreset = createDefaultEsmPreset({ + tsconfig: 'tsconfig-esm.spec.json', +}) /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...baseCfg, - preset: 'ts-jest/presets/js-with-babel-esm', + ...defaultPreset, + setupFilesAfterEnv: ['/src/setupTests.ts'], + testEnvironment: 'jsdom', transform: { - ...baseCfg.transform, - '^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': [ - 'ts-jest', - { - tsconfig: 'tsconfig-esm.spec.json', - useESM: true, - }, - ], + ...defaultPreset.transform, + '^.+\\.css$': '/config/jest/cssTransform.js', + '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '/config/jest/fileTransform.js', }, } diff --git a/examples/react-app/jest-isolated.config.cjs b/examples/react-app/jest-isolated.config.cjs index 4322f50702..f6d78166ff 100644 --- a/examples/react-app/jest-isolated.config.cjs +++ b/examples/react-app/jest-isolated.config.cjs @@ -1,16 +1,16 @@ const baseCfg = require('./jest.config.cjs') +const { createDefaultPreset } = require('ts-jest') + +const defaultPreset = createDefaultPreset({ + tsconfig: 'tsconfig.spec.json', + isolatedModules: true, +}) /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { ...baseCfg, transform: { ...baseCfg.transform, - '^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tsconfig.spec.json', - }, - ], + ...defaultPreset.transform, }, } diff --git a/examples/react-app/jest.config.cjs b/examples/react-app/jest.config.cjs index d2432212a0..3fde62cb08 100644 --- a/examples/react-app/jest.config.cjs +++ b/examples/react-app/jest.config.cjs @@ -1,17 +1,16 @@ +const { createDefaultPreset } = require('ts-jest') + +const defaultPreset = createDefaultPreset({ + tsconfig: 'tsconfig.spec.json' +}) + /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - roots: ['/src'], - collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'], setupFilesAfterEnv: ['/src/setupTests.ts'], testEnvironment: 'jsdom', transform: { - '^.+\\.(ts|tsx|js|jsx|mjs|cjs)$': ['ts-jest', { - tsconfig: 'tsconfig.spec.json', - }], + ...defaultPreset.transform, '^.+\\.css$': '/config/jest/cssTransform.js', '^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '/config/jest/fileTransform.js', }, - modulePaths: [], - moduleFileExtensions: ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'], - resetMocks: true, } diff --git a/examples/ts-only/jest-esm-isolated.config.mjs b/examples/ts-only/jest-esm-isolated.config.mjs index 60854a38d4..5da179626b 100644 --- a/examples/ts-only/jest-esm-isolated.config.mjs +++ b/examples/ts-only/jest-esm-isolated.config.mjs @@ -1,16 +1,10 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tsconfig-esm.json', + useESM: true, + isolatedModules: true, + }), } diff --git a/examples/ts-only/jest-esm.config.mjs b/examples/ts-only/jest-esm.config.mjs index 89583e7c65..82ec429402 100644 --- a/examples/ts-only/jest-esm.config.mjs +++ b/examples/ts-only/jest-esm.config.mjs @@ -1,15 +1,9 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ export default { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tsconfig-esm.json', + useESM: true, + }), } diff --git a/examples/ts-only/jest-isolated.config.cjs b/examples/ts-only/jest-isolated.config.cjs index 08ba2ebaca..9a0cff0afe 100644 --- a/examples/ts-only/jest-isolated.config.cjs +++ b/examples/ts-only/jest-isolated.config.cjs @@ -1,14 +1,8 @@ -const preset = require('ts-jest/presets'); +const { createDefaultPreset } = require('ts-jest'); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.defaults, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - }, - ], - }, + ...createDefaultPreset({ + isolatedModules: true, + }) } diff --git a/examples/ts-only/jest.config.cjs b/examples/ts-only/jest.config.cjs index c09314495e..862240b2d1 100644 --- a/examples/ts-only/jest.config.cjs +++ b/examples/ts-only/jest.config.cjs @@ -1,6 +1,6 @@ -const preset = require('ts-jest/presets'); +const { createDefaultPreset } = require('ts-jest'); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - ...preset.defaults, + ...createDefaultPreset() } diff --git a/examples/type-module/jest-esm-isolated.config.js b/examples/type-module/jest-esm-isolated.config.js index d0b7f1b9cd..16315c027e 100644 --- a/examples/type-module/jest-esm-isolated.config.js +++ b/examples/type-module/jest-esm-isolated.config.js @@ -1,18 +1,11 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ const jestConfig = { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - tsconfig: 'tsconfig-esm.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tsconfig-esm.json', + isolatedModules: true, + }), } export default jestConfig diff --git a/examples/type-module/jest-esm.config.js b/examples/type-module/jest-esm.config.js index 787d1afbfc..3ae95991ea 100644 --- a/examples/type-module/jest-esm.config.js +++ b/examples/type-module/jest-esm.config.js @@ -1,17 +1,10 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultEsmPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ const jestConfig = { - ...preset.defaultsESM, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - tsconfig: 'tsconfig.json', - useESM: true, - }, - ], - }, + ...createDefaultEsmPreset({ + tsconfig: 'tsconfig-esm.json', + }), } export default jestConfig diff --git a/examples/type-module/jest-isolated.config.js b/examples/type-module/jest-isolated.config.js index 6986444b56..ccf9b97b63 100644 --- a/examples/type-module/jest-isolated.config.js +++ b/examples/type-module/jest-isolated.config.js @@ -1,16 +1,10 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ const jestConfig = { - ...preset.defaults, - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - }, - ], - }, + ...createDefaultPreset({ + isolatedModules: true, + }), } export default jestConfig diff --git a/examples/type-module/jest.config.js b/examples/type-module/jest.config.js index 58a7b7ec78..9ace4cda2d 100644 --- a/examples/type-module/jest.config.js +++ b/examples/type-module/jest.config.js @@ -1,8 +1,8 @@ -import preset from 'ts-jest/presets/index.js' +import { createDefaultPreset } from 'ts-jest' /** @type {import('ts-jest').JestConfigWithTsJest} */ const jestConfig = { - ...preset.defaults, + ...createDefaultPreset(), } export default jestConfig