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.
38 lines
767 B
38 lines
767 B
2 years ago
|
// @remove-on-eject-begin
|
||
|
/**
|
||
|
* Copyright (c) 2014-present, Facebook, Inc.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*/
|
||
|
// @remove-on-eject-end
|
||
|
'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,
|
||
|
});
|