infinitered / infinitered/reactotron

Reactotron becomes undefined when mocking with jest

Open
#1,120 7 comments 5 reactions 0 assignees View on GitHub
docs :books: help wanted :wave:
Dominant language
TypeScript
Stars
15.6k
Forks
972
PR merge metrics
No merged PRs in 30d

Description

I have issues to get Reactotron working in my jest react-native test environment.
Before running a test I simply do
`jest.mock("reactotron-react-native");`, but then I receive an error stating
`TypeError: Cannot read property 'useReactNative' of undefined`
![Screenshot 2019-08-09 at 18 01 26](https://user-images.githubusercontent.com/16821682/62792504-bd64b080-bacf-11e9-96a8-0d33089332ac.png)

Unfortunately, I don't find any recommendation in your docs for setting reactotron up for testing.

Really appreciate your help in advance! :)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the React Native test setup with `jest.mock("reactotron-react-native")` and the reported `useReactNative` error. Review the Reactotron testing setup and documentation referenced by the issue; done means the mocking behavior is understood and a working recommendation or documented setup is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
mobile, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.