diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..8871cf2 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,12 @@ +module.exports = { + presets: [ + [ + "@babel/preset-env", + { + targets: { + node: "current", + }, + }, + ], + ], +}; diff --git a/jestconfig.json b/jestconfig.json index bb4ddb9..479e750 100644 --- a/jestconfig.json +++ b/jestconfig.json @@ -1,11 +1,15 @@ { "transform": { - "^.+\\.tsx?$": "ts-jest" + "^.+\\.tsx?$": "ts-jest", + "^.+\\.jsx?$": "babel-jest" }, "testRegex": "/tests/.*\\.test\\.(tsx?)$", "moduleNameMapper": { "^antd/es/(.+)$": "antd/lib/$1" }, + "transformIgnorePatterns": [ + "/node_modules/(?!(react-phone-hooks)/)" + ], "modulePathIgnorePatterns": [ "/examples" ], diff --git a/package.json b/package.json index f908287..513199e 100644 --- a/package.json +++ b/package.json @@ -81,11 +81,14 @@ "react-phone-hooks": "^0.1.12" }, "devDependencies": { + "@babel/core": "^7.26.0", + "@babel/preset-env": "^7.26.0", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.5.1", "@types/jest": "^29.5.7", "@types/react": "^18.2.34", "antd": "*", + "babel-jest": "^29.7.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "react": "^18.0.0",