diff --git a/jest.config.js b/jest.config.js index 9f7ea0e4..4885fc00 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,13 +2,20 @@ module.exports = { testEnvironment: 'jsdom', roots: ['/test'], transform: { - '^.+.(t|j)sx?$': [ + '\\.tsx?$': [ 'ts-jest', { tsconfig: { outDir: './.ts-jest' } } + ], + '\\.jsx?$': [ + 'babel-jest', + { + presets: ['@babel/preset-env'], + plugins: ['@babel/plugin-transform-modules-commonjs'] + } ] }, transformIgnorePatterns: [ diff --git a/jest.standalone.config.js b/jest.standalone.config.js index d21bdd73..c2aa545b 100644 --- a/jest.standalone.config.js +++ b/jest.standalone.config.js @@ -2,13 +2,20 @@ module.exports = { testEnvironment: 'jsdom', roots: ['/test'], transform: { - '^.+.(t|j)sx?$': [ + '\\.tsx?$': [ 'ts-jest', { tsconfig: { outDir: './.ts-jest' } } + ], + '\\.jsx?$': [ + 'babel-jest', + { + presets: ['@babel/preset-env'], + plugins: ['@babel/plugin-transform-modules-commonjs'] + } ] }, transformIgnorePatterns: [ diff --git a/package.json b/package.json index 91f328e3..a7e5d237 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,9 @@ "react-dom": ">=18" }, "devDependencies": { + "@babel/core": "^7.25.2", + "@babel/plugin-transform-modules-commonjs": "^7.24.8", + "@babel/preset-env": "^7.25.4", "@rollup/plugin-commonjs": "^26.0.1", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-terser": "^0.4.4", @@ -112,6 +115,7 @@ "@typescript-eslint/eslint-plugin": "^8.3.0", "@typescript-eslint/parser": "^8.3.0", "@typescript-eslint/typescript-estree": "^8.3.0", + "babel-jest": "^29.7.0", "bootstrap": "^5.1.3", "copyfiles": "^2.4.1", "css-loader": "^7.0.0", @@ -157,7 +161,7 @@ "ts-loader": "^9.3.0", "ts-node": "^10.8.0", "tsconfig-paths-webpack-plugin": "^4.0.0", - "typescript": "^5.3.3", + "typescript": "5.5", "webpack": "^5.20.1", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.2"