react-native/jest
Rob Hogan 2055ca0583 Set BUILD_EXCLUDE_BABEL_REGISTER: true under Jest tests (#42690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42690

Issues triggered by `InspectorProxy*` tests under `packages/dev-middleware` (T169943794) can be root-caused to `dev-middleware` performing Babel registration within a test run, after Jest has hooked its own transformer.

Babel registration is only required when running this code (`dev-middleware`, etc) directly from source - we already have the `BUILD_EXCLUDE_BABEL_REGISTER` mechanism to strip it out from production builds, but we currently don't prevent registration under tests, where Jest's transformer should be allowed to do its work.

This adds the same `babel-plugin-transform-define` mechanism that we use for production builds to the Jest transformer.

Changelog:
[Internal] Prevent inadvertent Babel registration during running of repo tests

Reviewed By: huntie

Differential Revision: D53125777

fbshipit-source-id: 1f0a20315c96edaf79054e29a80c7a9561e5b352
2024-01-27 06:49:15 -08:00
..
preprocessor.js Set BUILD_EXCLUDE_BABEL_REGISTER: true under Jest tests (#42690) 2024-01-27 06:49:15 -08:00