Skip to content

Commit 971bb81

Browse files
robhoganfacebook-github-bot
authored andcommitted
Monorepo Jest - remove now unnecessary Babel registration (#38146)
Summary: Pull Request resolved: #38146 Now that `metro-react-native-babel-transformer` may be loaded from source without transformation, we can remove this workaround / potential footgun. Jest uses Babel imperatively and doesn't rely on registration (require hooks), so registering within the preprocessor potentially conflicts and has caused problems before. This just tidies up some complexity we don't need. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D47162728 fbshipit-source-id: 06215f9bb7b8e71bcca0429d0bae9f20a22f45a8
1 parent 1202d39 commit 971bb81

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

jest/preprocessor.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ const nodeFiles = /[\\/]metro(?:-[^/]*)[\\/]/;
2828
// hook. This is used below to configure babelTransformSync under Jest.
2929
const {only: _, ...nodeBabelOptions} = metroBabelRegister.config([]);
3030

31-
// Register Babel to allow the transformer itself to be loaded from source.
32-
if (process.env.FBSOURCE_ENV) {
33-
// Internal: Use `@fb-scripts/babel-register` to re-use internal
34-
// registration, rather than potentially clobbering it and conflicting with
35-
// other Jest projects running in the same process.
36-
// This package should *NOT* be a dependency of `@react-native/monorepo`.
37-
// $FlowIgnore[cannot-resolve-module]
38-
require('@fb-scripts/babel-register');
39-
} else {
40-
metroBabelRegister([nodeFiles]);
41-
}
4231
const transformer = require('metro-react-native-babel-transformer');
4332

4433
module.exports = {

0 commit comments

Comments
 (0)