Skip to content

Commit

Permalink
Remove babel conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Mar 1, 2024
1 parent 2122ffa commit 3de9d73
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 16 deletions.
17 changes: 2 additions & 15 deletions config/jest/babelTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,10 @@

const babelJest = require("babel-jest").default;

const hasJsxRuntime = (() => {
try {
require.resolve("react/jsx-runtime");
return true;
} catch (e) {
return false;
}
})();

module.exports = babelJest.createTransformer({
presets: [
[
require.resolve("babel-preset-react-app"),
{
runtime: hasJsxRuntime ? "automatic" : "classic",
},
],
require.resolve("@babel/preset-env"),
require.resolve("@babel/preset-typescript"),
],
babelrc: false,
configFile: false,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"testEnvironment": "jsdom",
"preset": "ts-jest",
"transform": {
"^.+\\.jsx?$": "babel-jest",
"^.+\\.jsx?$": "<rootDir>/config/jest/babelTransform.js",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(cjs|js|jsx|mjs|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
Expand Down

0 comments on commit 3de9d73

Please sign in to comment.