Repository navigation
Closed
Closed
Copy link
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.
Description
Description
When performing test with jest, it reports missing some mock components.
Log available at: https://github.com/thu-info-community/thu-info-app/actions/runs/15625085983/job/44017663763
Cannot find module '../Libraries/Components/RefreshControl/__mocks__/RefreshControlMock' from '../../node_modules/react-native/jest/setup.js'
Require stack:
/home/runner/work/thu-info-app/thu-info-app/node_modules/react-native-gesture-handler/lib/commonjs/components/GestureComponents.js
/home/runner/work/thu-info-app/thu-info-app/node_modules/react-native-gesture-handler/lib/commonjs/index.js
src/ui/schedule/schedule.tsx
src/components/Root.tsx
src/App.tsx
test/render.test.tsx
32 | import {configSet, setCalendarConfig} from "../../redux/slices/config";
33 | import {getStatusBarHeight} from "react-native-safearea-height";
> 34 | import {GestureHandlerRootView, RefreshControl, ScrollView} from "react-native-gesture-handler";
| ^
35 | import {CalendarData, Semester} from "@thu-info/lib/src/models/schedule/calendar";
36 |
37 | const examBeginMap: {[key: string]: number} = {
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/index.js:868: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/lib/commonjs/components/GestureComponents.tsx:31:51)
at Object.require (../../node_modules/react-native-gesture-handler/lib/commonjs/index.ts:97:1)
at Object.require (src/ui/schedule/schedule.tsx:34:1)
at Object.require (src/components/Root.tsx:10:1)
at Object.require (src/App.tsx:11:1)
at Object.require (test/render.test.tsx:5:1)
Steps to reproduce
- import {GestureHandlerRootView, RefreshControl, ScrollView} from "react-native-gesture-handler"
- yarn test
BTW, I think the issue should reproduce regardless using react-native-gesture-handler or not.
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: (8) arm64 Apple M2
Memory: 116.70 MB / 24.00 GB
Shell:
version: 3.7.1
path: /opt/homebrew/bin/fish
Binaries:
Node:
version: 20.19.2
path: /var/folders/c0/3fm8z4hx4qsfnqhl0l_v34tm0000gn/T/yarn--1749783376193-0.5435812973456269/node
Yarn:
version: 1.22.19
path: /var/folders/c0/3fm8z4hx4qsfnqhl0l_v34tm0000gn/T/yarn--1749783376193-0.5435812973456269/yarn
npm:
version: 10.8.2
path: /opt/homebrew/opt/node@20/bin/npm
Watchman:
version: 2025.05.26.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.4
- iOS 18.4
- macOS 15.4
- tvOS 18.4
- visionOS 2.4
- watchOS 11.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode:
version: 16.3/16E140
path: /usr/bin/xcodebuild
Languages:
Java: Not Found
Ruby:
version: 2.6.10
path: /usr/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
Cannot find module '../Libraries/Components/RefreshControl/__mocks__/RefreshControlMock' from '../../node_modules/react-native/jest/setup.js'
Require stack:
/home/runner/work/thu-info-app/thu-info-app/node_modules/react-native-gesture-handler/lib/commonjs/components/GestureComponents.js
/home/runner/work/thu-info-app/thu-info-app/node_modules/react-native-gesture-handler/lib/commonjs/index.js
src/ui/schedule/schedule.tsx
src/components/Root.tsx
src/App.tsx
test/render.test.tsx
32 | import {configSet, setCalendarConfig} from "../../redux/slices/config";
33 | import {getStatusBarHeight} from "react-native-safearea-height";
> 34 | import {GestureHandlerRootView, RefreshControl, ScrollView} from "react-native-gesture-handler";
| ^
35 | import {CalendarData, Semester} from "@thu-info/lib/src/models/schedule/calendar";
36 |
37 | const examBeginMap: {[key: string]: number} = {
at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/index.js:868: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/lib/commonjs/components/GestureComponents.tsx:31:51)
at Object.require (../../node_modules/react-native-gesture-handler/lib/commonjs/index.ts:97:1)
at Object.require (src/ui/schedule/schedule.tsx:34:1)
at Object.require (src/components/Root.tsx:10:1)
at Object.require (src/App.tsx:11:1)
at Object.require (test/render.test.tsx:5:1)
MANDATORY Reproducer
https://github.com/UNIDY2002/rn-80-mocks-repro
Screenshots and Videos
No response
Reacted by Ivan Sekovanikj and Mateusz Łopaciński
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.
Activity
react-native-bot commentedon Jun 13, 2025
Warning
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
You can read more about about it on our website: How to report a bug.
[-][0.80.0] Some __mocks__ files missing from the react-native package[/-][+][0.80.0] Some __mocks__ files missing from the react-native package (repro updated)[/+]UNIDY2002 commentedon Jun 13, 2025
@react-native-bot Repro has been updated
isekovanic commentedon Jun 13, 2025
+1 for this, it just came to my attention as well.
For those of you who are stuck, I was able to resolve this by doing:
and then adding:
at the root of the repository.
The reason is that the mock no longer exists here as it is implied, but has been moved/removed (probably here, although it doesn't exist on
0.80).cipolleschi commentedon Jun 13, 2025
potentially a duplicate of #51375
cipolleschi commentedon Jun 16, 2025
I also surfaced the issue to our Developer Experience team. Hopefully we can find a solution soon.
UNIDY2002 commentedon Jul 3, 2025
This issue is fixed in 0.80.1. Thanks all :)
troZee commentedon Jul 17, 2025
The RN 80.1 did not fix my issue
Inside my node_modules, I am not able to find this path
react-native/Libraries/Utilities/__mocks__/