From 25f8a656da45d3adb826215859d7f8e58154fcc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro?= Date: Tue, 28 Nov 2017 20:15:27 +0100 Subject: [PATCH 1/2] Note about mocking Jest --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 59b07a0..2680a5e 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ npm i react-native-mock-render --save-dev require('react-native-mock-render/mock'); // <-- side-effects!!! ``` +### Jest + +Jest [don't support](https://github.com/Root-App/react-native-mock-render/issues/23) `require.cache`, so the correct way to do the mocking is using `jest.mock('react-native', () => require('react-native-mock-render'), {virtual: true})` at 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`. From c6278f5c74dfa7061318f2bb4762cc752f835fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro?= Date: Tue, 28 Nov 2017 20:22:14 +0100 Subject: [PATCH 2/2] Spellchecks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2680a5e..1239309 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ require('react-native-mock-render/mock'); // <-- side-effects!!! ### Jest -Jest [don't support](https://github.com/Root-App/react-native-mock-render/issues/23) `require.cache`, so the correct way to do the mocking is using `jest.mock('react-native', () => require('react-native-mock-render'), {virtual: true})` at your tests setup file. +Jest [doesn't support](https://github.com/Root-App/react-native-mock-render/issues/23) `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?