mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 21:27:46 +00:00
Register Babel in Jest setup to load transformer (#39251)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39251 As `react-native/babel-preset` is extended to include parts of codegen (written in Flow) via `react-native/babel-plugin-codegen`, we need to register Babel (with a Node JS config) in order to load the `react-native/babel-transformer` that Jest needs to transform RN code when running from source. (This is *only* relevant to running from source, ie internally at Meta or when developing on a clone of the OSS repo) Changelog: [Internal] Reviewed By: huntie Differential Revision: D48871440 fbshipit-source-id: 2f206b2380d67007e37782f211a6e831b35291f8
This commit is contained in:
parent
aa2a0c1115
commit
5c513cb2f8
@ -32,6 +32,8 @@ const nodeFiles = /[\\/]metro(?:-[^/]*)[\\/]/;
|
||||
// hook. This is used below to configure babelTransformSync under Jest.
|
||||
const {only: _, ...nodeBabelOptions} = metroBabelRegister.config([]);
|
||||
|
||||
// Register Babel to allow the transformer itself to be loaded from source.
|
||||
require('../scripts/build/babel-register').registerForMonorepo();
|
||||
const transformer = require('@react-native/metro-babel-transformer');
|
||||
|
||||
module.exports = {
|
||||
|
Loading…
Reference in New Issue
Block a user