【发布时间】:2018-01-29 20:47:41
【问题描述】:
我正在尝试测试我的组件,但是导出 createFragmentContainer 的每个组件都向我显示了这个问题:
console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:73
Warning: Failed context type: Invalid prop/context `relay` supplied to `Relay(Product)`, expected `undefined` to be an object with an `environment` and `variables`.
in Relay(Product)
console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:73
React caught an error thrown by Relay(Product). You should fix this error in your code. Consider adding an error boundary to your tree to customize error handling behavior.
TypeError: Cannot read property 'environment' of undefined
The error is located at:
in Relay(Product)
那么 jest 是否支持片段容器或者问题出在我的项目中?
【问题讨论】:
-
我也遇到了同样的问题!你有没有在这个问题上取得任何进展@FrankenStein?
-
看看relay.dev/docs/en/testing-relay-components你可以使用relay-test-utils
标签: reactjs unit-testing react-native jestjs