Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. React Native
  3. react-native-mock

react-native-mock

MITJavaScriptv0.3.1

A fully mocked and test-friendly version of React Native for easier unit testing of React Native components.

GitHubGitHub
566 stars151 forks0 contributors

What is react-native-mock?

react-native-mock is a library that provides a fully mocked version of React Native, enabling developers to test React Native components in a Node.js environment without relying on native simulators or devices. It solves the problem of difficult and slow testing setups by replacing native modules with JavaScript mocks.

Target Audience

React Native developers who need to write unit tests for their components and want to avoid the overhead of native testing environments.

Value Proposition

It simplifies the testing workflow by allowing tests to run entirely in Node.js, making it faster and more accessible than traditional React Native testing methods that require native runtimes.

Overview

A fully mocked and test-friendly version of react native (maintainers wanted)

Use Cases

Best For

  • Unit testing React Native components in a CI/CD pipeline
  • Testing React Native apps without an iOS or Android simulator
  • Integrating React Native tests with JavaScript testing frameworks like Jest
  • Mocking native modules for isolated component testing
  • Running React Native tests in a Node.js environment
  • Simplifying test setup for React Native projects

Not Ideal For

  • Testing apps that rely heavily on unimplemented native APIs or platform-specific behaviors
  • Projects using older versions of React Native, as it requires matching versions and may have breaking changes
  • Teams needing end-to-end or integration tests with real device or simulator interactions

Pros & Cons

Pros

Node.js Test Environment

Allows React Native components to be tested in Node.js, eliminating the need for native simulators or devices, as highlighted in the key features for faster testing.

Simple Integration Setup

Mutates React Native's require cache with a single import, making it straightforward to set up in test files, per the README example.

Full Native Module Mocking

Replaces React Native's native modules with JavaScript implementations, enabling isolated unit testing without native dependencies.

Alignment with Latest API

Maintains compatibility with the latest React Native API to ensure reliability, as stated in the requirements section.

Cons

Version Compatibility Hassles

Only designed for the most recent React Native version; using older versions requires downloading specific older mock versions, leading to potential breakage and maintenance issues.

Mock Accuracy Limitations

Since it mocks native modules, it may not fully replicate all native behaviors or edge cases, risking false test results for complex interactions.

Maintenance and Uncertainty

The README admits uncertainty about the approach and calls for maintainers, raising concerns about long-term support and stability.

Frequently Asked Questions

Quick Stats

Stars566
Forks151
Contributors0
Open Issues33
Last commit7 years ago
CreatedSince 2016

Tags

#unit-testing#test-environment#frontend-testing#react-native#nodejs#testing#mock#javascript#react

Built With

J
JavaScript
N
Node.js

Included in

React Native35.6k
Auto-fetched 8 hours ago

Related Projects

detoxdetox

Gray box end-to-end testing and automation framework for mobile apps

Stars12,026
Forks1,911
Last commit22 hours ago
lokiloki

👁 Visual Regression Testing for Storybook

Stars1,910
Forks182
Last commit1 year ago
react-native-workersreact-native-workers

Background services and web workers for react-native

Stars801
Forks89
Last commit7 years ago
react-native-network-loggerreact-native-network-logger

An HTTP network request monitor for React Native with in-app interface for iOS and Android with no native code

Stars687
Forks68
Last commit2 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub