Check if test runner is of right type before accessing its internals
Summary: I previously added this check to make the test complete waits until all teardown completed but if you're running tests with any other executor than the JSC one, this would crash. @public Reviewed By: @jspahrsummers Differential Revision: D2493967
This commit is contained in:
parent
7f9cf97767
commit
f3a6466fcd
|
@ -15,6 +15,7 @@
|
|||
#import "RCTRootView.h"
|
||||
#import "RCTTestModule.h"
|
||||
#import "RCTUtils.h"
|
||||
#import "RCTContextExecutor.h"
|
||||
|
||||
static const NSTimeInterval kTestTimeoutSeconds = 60;
|
||||
static const NSTimeInterval kTestTeardownTimeoutSeconds = 30;
|
||||
|
@ -114,7 +115,10 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
|||
|
||||
// Take a weak reference to the JS context, so we track its deallocation later
|
||||
// (we can only do this now, since it's been lazily initialized)
|
||||
weakJSContext = [[[bridge valueForKey:@"batchedBridge"] valueForKey:@"javaScriptExecutor"] valueForKey:@"context"];
|
||||
id jsExecutor = [bridge valueForKeyPath:@"batchedBridge.javaScriptExecutor"];
|
||||
if ([jsExecutor isKindOfClass:[RCTContextExecutor class]]) {
|
||||
weakJSContext = [jsExecutor valueForKey:@"context"];
|
||||
}
|
||||
[rootView removeFromSuperview];
|
||||
|
||||
RCTSetLogFunction(RCTDefaultLogFunction);
|
||||
|
|
Loading…
Reference in New Issue