You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
526 B
29 lines
526 B
'use strict';
|
|
|
|
const babelJest = require('babel-jest');
|
|
|
|
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,
|
|
});
|
|
|