mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
reactComponentExpect fails silently
```reactComponentExpect``` fails silently when passed an undefined value. It calls ```ReactTestUtils.isCompositeComponent``` with the undefined value, in which a ```render``` property is accessed, throwing a prop on undefined not found error which isn't surfaced to jest.
```
TypeError: Cannot read property 'render' of undefined
at Object.ReactTestUtils.isCompositeComponent (./react/test/ReactTestUtils.js:127:23)
at new reactComponentExpect (./react/test/reactComponentExpect.js:46:20)
at reactComponentExpect (./react/test/reactComponentExpect.js:40:12)
```
Expecting the passed-in instance to not be undefined surfaces this issue in the test runner.
This commit is contained in:
1 parent
7f119d41c7
commit
39c3fb2b09
1 file changed
+1
@@ -28,6 +28,7 @@ function reactComponentExpect(instance) {
|
||||
}
|
||||
|
||||
expect(instance).not.toBeNull();
|
||||
expect(instance).not.toBeUndefined();
|
||||
|
||||
invariant(
|
||||
ReactTestUtils.isCompositeComponent(instance),
|
||||
|
||||
Reference in new issue
Block a user