I’ve been developing an app for a couple of weeks now. I started trying to add basic Jest tests, but am receiving an error that I have deduced is caused by MapView. When I remove the whole MapView from the component, the basic Jest snapshot test passes. The error I’m seeing is:
React caught an error thrown by View. You should fix this error in your code. Consider adding an error boundary to your tree to customize error handling behavior.
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in.
Anyone encountered this before, or have any potential solutions?
Hmm. If its working in snack, and not in your jest tests, check if you’ve exported your app class and that jest is able to reference your component properly
My app source code is here: http://github.com/devanb/whats-open, btw. And I believe CRNA is using jest-expo by default, because I see it in my presets.
@thetc Is there anything specific I need to do to “use” jest-expo? This project is a CRNA project, and I see the jest-expo is a preset in my package.json already by default.