0.1.3 • Published 7 years ago

react-native-mock-render-hacked v0.1.3

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

react-native-mock-render

An original fork of react-native-mock package that renders components.

Another forked version of react-native-mock-render.

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