这是我的根组成部分:
const App = () => (
<Provider store={store}>
<PersistGate persistor={persistor} loading={<LoadingView />}>
<MainTabNavigator />
</PersistGate>
</Provider>
)
export default App
这是一个非常简单的快照测试:
describe('Testing root App component', () => {
test('Renders as expected', () => {
const tree = renderer.create(<App />).toJSON()
expect(tree).toMatchSnapshot()
})
})
当我运行测试时,它会通过,但我在其下面收到此错误消息:
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.
因为测试通过,这甚至不重要吗?发生了什么事?