Open
Description
Description
We've upgraded React Native to 0.80.0 in https://github.com/expo/expo and are seeing some test failures due to incorrect mock references.
- It seems that '[skip ci] [RN] Replace .npmignore files, ignore all test/fixture/docs directories #50784 excluded actively used files, like
react-native/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock
(here). - This seems the be fixed in RN: Refactor Jest Default Mocks #51669, but this doesn't seem to be available for
0.80.x
yet.
Steps to reproduce
- Create a React Native project
- Setup a Jest test
- Import
react-native/Libraries/Components/RefreshControl/RefreshControl
- Causes the error here
Or, use the Expo repository:
git clone https://github.com/expo/expo ./expo
cd ./expo
yarn --frozen-lockfile
cd packages/expo-router
yarn jest smoke
React Native Version
0.80.0
Affected Platforms
Other (please specify)
Output of npx @react-native-community/cli info
System:
OS: macOS 15.5
CPU: (12) arm64 Apple M2 Max
Memory: 135.50 MB / 96.00 GB
Shell:
version: "5.9"
path: /opt/homebrew/bin/zsh
Binaries:
Node:
version: 22.16.0
path: ~/.nvm/versions/node/v22.16.0/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v22.16.0/bin/yarn
npm:
version: 11.4.2
path: ~/.nvm/versions/node/v22.16.0/bin/npm
Watchman:
version: 2025.05.26.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /Users/cedric/Projects/expo/expo/.direnv/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.5
- iOS 18.5
- macOS 15.5
- tvOS 18.5
- visionOS 2.5
- watchOS 11.5
Android SDK:
API Levels:
- "31"
- "33"
- "33"
- "34"
- "35"
Build Tools:
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 34.0.0
- 35.0.0
System Images:
- android-30 | Google APIs ARM 64 v8a
- android-31 | Google APIs ARM 64 v8a
- android-33 | Google APIs ARM 64 v8a
- android-34 | Google Play ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.12816248
Xcode:
version: 16.4/16F6
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.15
path: /usr/bin/javac
Ruby:
version: 3.3.6
path: /Users/cedric/.rvm/rubies/ruby-3.3.6/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
FAIL iOS src/__tests__/smoke.test.ios.tsx
● Test suite failed to run
Cannot find module '../Libraries/Components/RefreshControl/__mocks__/RefreshControlMock' from '../../node_modules/react-native/jest/setup.js'
Require stack:
/Users/cedric/Projects/expo/expo/node_modules/react-native-gesture-handler/lib/commonjs/components/GestureComponents.js
/Users/cedric/Projects/expo/expo/node_modules/react-native-gesture-handler/lib/commonjs/index.js
/Users/cedric/Projects/expo/expo/node_modules/react-native-drawer-layout/lib/module/views/GestureHandlerNative.js
/Users/cedric/Projects/expo/expo/node_modules/react-native-drawer-layout/lib/module/views/GestureHandler.ios.js
/Users/cedric/Projects/expo/expo/node_modules/react-native-drawer-layout/lib/module/views/Drawer.native.js
/Users/cedric/Projects/expo/expo/node_modules/react-native-drawer-layout/lib/module/index.js
/Users/cedric/Projects/expo/expo/node_modules/@react-navigation/drawer/lib/module/views/DrawerView.js
/Users/cedric/Projects/expo/expo/node_modules/@react-navigation/drawer/lib/module/navigators/createDrawerNavigator.js
/Users/cedric/Projects/expo/expo/node_modules/@react-navigation/drawer/lib/module/index.js
src/layouts/DrawerClient.tsx
src/layouts/Drawer.tsx
src/__tests__/smoke.test.ios.tsx
1 | 'use client';
2 |
> 3 | import {
| ^
4 | createDrawerNavigator,
5 | DrawerNavigationOptions,
6 | DrawerNavigationEventMap,
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:427:11)
at requireActual (../../node_modules/react-native/jest/setup.js:204:19)
at Object.require [as RefreshControl] (../../node_modules/react-native/index.js:84:12)
at Object.RefreshControl (../../node_modules/react-native-gesture-handler/src/components/GestureComponents.tsx:31:51)
at Object.require (../../node_modules/react-native-gesture-handler/src/index.ts:97:1)
at Object.require (../../node_modules/react-native-drawer-layout/src/views/GestureHandlerNative.tsx:2:1)
at Object.require (../../node_modules/react-native-drawer-layout/src/views/GestureHandler.ios.tsx:1:1)
at Object.require (../../node_modules/react-native-drawer-layout/src/views/Drawer.native.tsx:27:1)
at Object.require (../../node_modules/react-native-drawer-layout/src/index.tsx:4:1)
at Object.require (../../node_modules/@react-navigation/drawer/src/views/DrawerView.tsx:19:1)
at Object.require (../../node_modules/@react-navigation/drawer/src/navigators/createDrawerNavigator.tsx:20:1)
at Object.require (../../node_modules/@react-navigation/drawer/src/index.tsx:4:1)
at Object.require (src/layouts/DrawerClient.tsx:3:1)
at Object.require (src/layouts/Drawer.tsx:1:1)
at Object.require (src/__tests__/smoke.test.ios.tsx:4:1)
Test Suites: 1 failed, 1 total
MANDATORY Reproducer
Screenshots and Videos
No response