Skip to content

React Native 0.80.0's jest setup is broken due to missing mock files #52152

Open
@byCedric

Description

@byCedric

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.

Steps to reproduce

  1. Create a React Native project
  2. Setup a Jest test
  3. Import react-native/Libraries/Components/RefreshControl/RefreshControl
  4. Causes the error here
    Image

Or, use the Expo repository:

  1. git clone https://github.com/expo/expo ./expo
  2. cd ./expo
  3. yarn --frozen-lockfile
  4. cd packages/expo-router
  5. 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

https://github.com/expo/expo

Screenshots and Videos

No response

Metadata

Metadata

Assignees

Labels

Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.PartnerResolution: PR SubmittedA pull request with a fix has been provided.p: ExpoPartner: Expo

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions