Reproduce:
console:
FAIL __tests__/index.android.js
● Test suite failed to runTypeError: Cannot read property 'updateExceptionMessage' of undefined at trackGlobalErrors (node_modules/reactotron-react-native/dist/index.js:72:61) at Client.Object.<anonymous>.trackGlobalErrors (node_modules/reactotron-react-native/dist/index.js:85:5)
at Client.use (node_modules/reactotron-core-client/dist/index.js:605:44)
at Client.Object..reactotron.useReactNative (node_modules/reactotron-react-native/dist
/index.js:715:16)
at Object.(ReactotronConfig.js:5:1)
at Object.(index.android.js:6:1) FAIL __tests__/index.ios.js
● Test suite failed to runTypeError: Cannot read property 'updateExceptionMessage' of undefined at trackGlobalErrors (node_modules/reactotron-react-native/dist/index.js:72:61) at Client.Object.<anonymous>.trackGlobalErrors (node_modules/reactotron-react-native/dist/index.js:85:5)
at Client.use (node_modules/reactotron-core-client/dist/index.js:605:44)
at Client.Object..reactotron.useReactNative (node_modules/reactotron-react-native/dist
/index.js:715:16)
at Object.(ReactotronConfig.js:5:1)
at Object.(index.ios.js:6:1) Test Suites: 2 failed, 2 total
Tests: 0 total
Snapshots: 0 total
Time: 1.152s
Ran all test suites.
If I remove _import './ReactotronConfig'_ from index.android.js or index.ios.js files, test pass
Application and Reactotron work perfectly with react-native run
Basically what is happening is the trackGlobalErrors is trying to hook into NativeModules.ExceptionsManager.updateExceptionMessage which likely isn't mocked in the default jest setup. This should be solved by mocking NativeModules.ExceptionsManager with even an empty object.
Even without using trackGlobalErrors on the ReactotronConfig.js file?
How would you mock NativeModules.ExceptionsManager? I cant find it with search all files
If you don't have trackGlobalErrors it shouldn't crash - can you provide your ReactotronConfig.js?
import Reactotron from 'reactotron-react-native'
Reactotron
.configure() // controls connection & communication settings
.useReactNative() // add all built-in react native plugins
.connect() // let's connect!
.useReactNative() actually wires up trackGlobalErrors. Try this and see if it fixes this issue (for a short term fix until I work out the proper way to mock it):
.useReactNative({
errors: false,
})
It did! Thanks!
@aschenkel PR created to fix this issue for real. I couldn't find a good way to fix this with a Jest mock since that would essentially be adding to a mock that exists which I guess isn't a thing...? Anyway... I added a check when wiring up trackGlobalErrors so that it can run in testing environments successfully while still being enabled for device environments. Once this lands you can drop the errors: false configuration if you feel so inclined.
Merged. Will release shortly. On a plane ATM.