Projects
View on GitHub
vanGalilea/react-native-testing
vanGalilea/react-native-testing has 659 GitHub stars and 79 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 23:44 UTC. Last push 2025-03-07.
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
This is how you should test your react-native components with Jest and React Native Testing Library
Web & AppsREADME.md
Original
No More Hacks and Headaches <> Learn How to Test Your Components Before Your Users Will
Covered Examples 🎞
- 👆 Clicking buttons and asserting onPress' outcome.
- 📲 Filling a simple login form and asserting successful submission.
- 🎣 Custom hook testing (number of alternatives).
- 📡 Mocking fetch calls.
- 🧭 Navigating through screens with React Navigation.
- 🚟 Navigating through screens with Expo Router.
- 🔚 E2E feel due to real navigation throughout screens.
- 📥 Handling and mocking providers.
- 📹 Mocking external lib.'s components.
- 🎭 Mocking and interacting with RN's Modal component.
- 🧾 Handling with a screen with RN's FlatList component.
- 📡 Using MSW to mock api calls and handling loading/errors.
Tools in use 🛠️
Setup and requirements 📋
Getting Started 🚀
- Clone the repo
git clone [email protected]:vanGalilea/react-native-testing.git - Run
yarnto install dependencies - Explore RN CLI app and/or Expo app's tests and source code that are relevant to your use case.
RN CLI application
How to run the tests 🏃♀️
- Run
cd apps/rn-cli-appto navigate to the app folder - Run
yarn test:unitto run the unit tests - Run
yarn test:unit:devto run the unit tests in dev/watch mode - Run
yarn test:unit:coverageto run the tests and generate a coverage report
Make sure you have built and run the app in dev mode before running the e2e tests.
- Run
yarn test:e2eto run the e2e tests - Run
yarn test:e2e:devto run the e2e tests in dev/watch mode - Run
yarn test:e2e:recordto run the e2e tests and record a video of the tests
How to run the app 📱
- Run
cd apps/rn-cli-appto navigate to the app folder - Run
npx pod-installto install iOS dependencies - Run
yarn startto start the metro bundler - Click
ito run the app on iOS simulator orato run it on Android emulator
Expo application
How to run the tests 🏃♀️
- Run
cd apps/rn-expo-appto navigate to the app folder - Run
yarn test:unitto run the unit tests
How to run the app 📱
- Run
cd apps/rn-expo-appto navigate to the app folder - Run
yarn startto start the metro bundler - Click
ito run the app on iOS simulator orato run it on Android emulator
Inspiration, resources and further reading 📚
- 📑 A blog by Steve Galili on "Where and How to Start Testing Your React Native App"
- 👏 Inspired by Kent C. Dodds' workshop Test React Components with Jest and React Testing Library. For more info check Epic React.
- 📕 React Native Testing Library
- 🧑🔬️ Jest
- ️⚛️ React Native
- 🗺 React Navigation
- 🛰 MSW