Using preset 'react-native' for Jest breaks .babelrc usage in monorepo
See original GitHub issueDescription
I have a monorepo where there is a babel.config.js in the root and I want to have a .babelrc in the package that has react-native. Previously, I had a babel.config.js in that package. I noticed that if I comment out preset: 'react-native'
in my jest.config.js, the .babelrc DOES get read, but obviously throws a bunch of errors because the preset sets up a bunch of mocks. I don’t see anything in the jest setup file the preset uses that specifically skips a .babelrc.
I am following https://babeljs.io/docs/en/config-files#root-babelconfigjson-file and https://babeljs.io/docs/en/config-files#subpackage-babelrcjson-files.
Version
0.67.4
Output of npx react-native info
System: OS: macOS 12.3.1 CPU: (16) x64 Intel® Core™ i9-9880H CPU @ 2.30GHz Memory: 154.58 MB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.0 - /private/var/folders/93/1k48nb2j093b_cfpbcf6cq1n4c68j2/T/xfs-050c6f0a/node Yarn: 3.0.2 - /private/var/folders/93/1k48nb2j093b_cfpbcf6cq1n4c68j2/T/xfs-050c6f0a/yarn npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm Watchman: 2021.10.18.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/eliw00d/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild Languages: Java: 1.8.0_292 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Set up a monorepo with a mobile package that used npx react-native init
to set it up. Add a jest.config.js with preset react-native. Rename the babel.config.js to .babelrc.js and add a babel.config.js to monorepo root. Add babelrcRoots to babel.config.js and try running tests. See repro for all of this.
Snack, code example, screenshot, or link to a repository
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Hi @eliw00d. The label only indicates that the Issue has been opened targeting the Old Architecture (0.67.4).
The new architecture support starts to version 0.68. We are also releasing some improvements to the setup of
babel
.I’m not sure whether the improvement may be solve your issues, but I would try to update to 0.68 and see what happens.
This issue was closed because it has been stalled for 7 days with no activity.