From 39c3fb2b097c4d2d7b7bb9b5b1a33b88c180fd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Ren=C3=A9e=20Beach?= Date: Fri, 7 Aug 2015 11:21:45 -0700 Subject: [PATCH] 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. --- src/test/reactComponentExpect.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/reactComponentExpect.js b/src/test/reactComponentExpect.js index b66a185651..7c40909dad 100644 --- a/src/test/reactComponentExpect.js +++ b/src/test/reactComponentExpect.js @@ -28,6 +28,7 @@ function reactComponentExpect(instance) { } expect(instance).not.toBeNull(); + expect(instance).not.toBeUndefined(); invariant( ReactTestUtils.isCompositeComponent(instance),