11

This is my root component:

const App = () => (
    <Provider store={store}>
        <PersistGate persistor={persistor} loading={<LoadingView />}>
            <MainTabNavigator />
        </PersistGate>
    </Provider>
)
export default App

And a pretty simple snapshot test for it:

describe('Testing root App component', () => {
    test('Renders as expected', () => {
        const tree = renderer.create(<App />).toJSON()
        expect(tree).toMatchSnapshot()
    })
})

When I run the test, it passes but I get this error message under it:

PASS  __tests__/App.test.tsx
  ● Console

    console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5190
      The above error occurred in the <TabView> component:
          in TabView (created by withCachedChildNavigation(TabView))
          in withCachedChildNavigation(TabView)
          in Unknown (created by Navigator)
          in Navigator (created by NavigationContainer)
          in NavigationContainer (created by App)
          in PersistGate (created by App)
          in Provider (created by App)
          in App

      Consider adding an error boundary to your tree to customize error handling behavior.
      Visit (url) to learn more about error boundaries.

Because the test passes, does this even matter? What's going on?

Philip S
  • 502
  • 6
  • 18
  • 1
    Me too: console.error ...react-test-renderer.development.js:5190 The above error occurred in the component: in CardStack (created by Transitioner) in View (created by View) in View (created by Transitioner) in Transitioner (created by CardStackTransitioner) in CardStackTransitioner in Unknown (created by Navigator) in Navigator (created by NavigationContainer) in NavigationContainer (created by RootComponent) in RootComponent (created by Connect(RootComponent)) in Connect(RootComponent) (created by App) in PersistGate (created by App) in Provider (created by App) in App – user4184113 Jun 12 '18 at 03:36
  • @PhilipS Did you find out about this? – ataravati Mar 17 '20 at 00:24
  • @ataravati Nope. At the time I just chose to ignore it because it wasn't breaking anything. Hasn't happened for me in a long while though – Philip S Mar 30 '20 at 06:12
  • @PhilipS OK, thanks! – ataravati Mar 30 '20 at 14:56

0 Answers0