a fork of react-native-mock that renders
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Adds resetAnimation method to AnimatedValue Sep 7, 2018
test Adds a mock for React Native Share Aug 21, 2018
.babelrc Use react-native babel preset May 25, 2016
.eslintrc
.gitignore Git ignore IntelliJ Idea folder May 7, 2018
.npmignore Stop some things being published to NPM Jul 13, 2016
.travis.yml Remove tests on node 5 Nov 18, 2016
CONTRIBUTING.md
LICENSE
README.md Spellchecks Nov 28, 2017
mock.js Lint mock.js Jun 1, 2016
package.json 0.1.2 Sep 7, 2018
yarn.lock Fix Dimensions.removeEventListener May 7, 2018

README.md

react-native-mock-render

A fork of react-native-mock that renders components

Requirements

  • Node.js 4+
  • The latest version of react-native

Installation

npm i react-native-mock-render --save-dev
/* file-that-runs-before-all-of-my-tests.js */

// This will mutate `react-native`'s require cache with `react-native-mock`'s.
require('react-native-mock-render/mock'); // <-- side-effects!!!

Jest

Jest doesn't support require.cache, so the correct way to do the mocking is using jest.mock('react-native', () => require('react-native-mock-render'), {virtual: true}) in your tests setup file.

Why?

We wanted to be able deeply render React Native components in our integration tests and already used react-native-mock.

Contributors

react-native-mock Core Contributors