From f15d9dd90b394fa9b0ef63da755af25d855acd98 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Tue, 24 Sep 2019 17:00:09 -0700 Subject: [PATCH] [React Native] Improve logging for missing view configs and invalid view config getter functions --- .../__tests__/ReactNativeError-test.internal.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/react-native-renderer/src/__tests__/ReactNativeError-test.internal.js b/packages/react-native-renderer/src/__tests__/ReactNativeError-test.internal.js index 42c07a645a7f8..3e8fbc85dfe8b 100644 --- a/packages/react-native-renderer/src/__tests__/ReactNativeError-test.internal.js +++ b/packages/react-native-renderer/src/__tests__/ReactNativeError-test.internal.js @@ -33,14 +33,12 @@ describe('ReactNativeError', () => { }); it('should throw error if null component registration getter is used', () => { - let error; - try { - createReactNativeComponentClass('View', null); - } catch (e) { - error = e; - } - - expect(error.toString()).toBe('Invariant Violation: View config getter callback must be a function: View (received null)'); + try { + createReactNativeComponentClass('View', null) + } catch (e) { + throw new Error(e.toString()); + } + }).toThrow('Invariant Violation: View config getter callback must be a function: View (received null)'); }); it('should be able to extract a component stack from a native view', () => {