mirror of
https://github.com/Mastermindzh/react-starter-kit.git
synced 2025-01-20 18:41:41 +01:00
30 lines
534 B
JavaScript
30 lines
534 B
JavaScript
"use strict";
|
|
|
|
const babelJest = require("babel-jest").default;
|
|
|
|
const hasJsxRuntime = (() => {
|
|
if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
|
|
return false;
|
|
}
|
|
|
|
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",
|
|
},
|
|
],
|
|
],
|
|
babelrc: false,
|
|
configFile: false,
|
|
});
|