Pass scriptURL to RCTTestRunner
Summary: Pass scriptURL to RCTTestRunner. If the scriptURL passed to RCTTestRunner is not nil, then RCTTestRunner will use it. else, RCTTestRunner will use whatever it has before. Differential Revision: D6215186 fbshipit-source-id: c3a5643021d60579fc8e60a69de150f6a4a39237
This commit is contained in:
parent
d79e245d19
commit
266ab7a006
|
@ -32,10 +32,11 @@
|
|||
* Use the RCTInitRunnerForApp macro for typical usage. See FBSnapshotTestCase.h for more information
|
||||
* on how to configure the snapshotting system.
|
||||
*/
|
||||
#define RCTInitRunnerForApp(app__, moduleProvider__) \
|
||||
#define RCTInitRunnerForApp(app__, moduleProvider__, scriptURL__) \
|
||||
[[RCTTestRunner alloc] initWithApp:(app__) \
|
||||
referenceDirectory:@FB_REFERENCE_IMAGE_DIR \
|
||||
moduleProvider:(moduleProvider__)]
|
||||
moduleProvider:(moduleProvider__) \
|
||||
scriptURL: scriptURL__]
|
||||
|
||||
@protocol RCTBridgeModule;
|
||||
@class RCTBridge;
|
||||
|
@ -68,7 +69,8 @@
|
|||
*/
|
||||
- (instancetype)initWithApp:(NSString *)app
|
||||
referenceDirectory:(NSString *)referenceDirectory
|
||||
moduleProvider:(RCTBridgeModuleListProvider)block NS_DESIGNATED_INITIALIZER;
|
||||
moduleProvider:(RCTBridgeModuleListProvider)block
|
||||
scriptURL:(NSURL *)scriptURL NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Simplest runTest function simply mounts the specified JS module with no
|
||||
|
|
|
@ -31,6 +31,7 @@ static const NSTimeInterval kTestTimeoutSeconds = 120;
|
|||
- (instancetype)initWithApp:(NSString *)app
|
||||
referenceDirectory:(NSString *)referenceDirectory
|
||||
moduleProvider:(RCTBridgeModuleListProvider)block
|
||||
scriptURL:(NSURL *)scriptURL
|
||||
{
|
||||
RCTAssertParam(app);
|
||||
RCTAssertParam(referenceDirectory);
|
||||
|
@ -46,7 +47,12 @@ static const NSTimeInterval kTestTimeoutSeconds = 120;
|
|||
_testController.referenceImagesDirectory = referenceDirectory;
|
||||
_moduleProvider = [block copy];
|
||||
_appPath = app;
|
||||
[self updateScript];
|
||||
|
||||
if (scriptURL != nil) {
|
||||
_scriptURL = scriptURL;
|
||||
} else {
|
||||
[self updateScript];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ static ControlBlock reactContentSizeUpdateBlock(RCTRootViewSizeFlexibility sizeF
|
|||
|
||||
- (void)setUp
|
||||
{
|
||||
_runner = RCTInitRunnerForApp(@"IntegrationTests/RCTRootViewIntegrationTestApp", nil);
|
||||
_runner = RCTInitRunnerForApp(@"IntegrationTests/RCTRootViewIntegrationTestApp", nil, nil);
|
||||
}
|
||||
|
||||
#pragma mark Logic Tests
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
- (void)setUp
|
||||
{
|
||||
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil);
|
||||
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil, nil);
|
||||
_runner.recordMode = NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
- (void)setUp
|
||||
{
|
||||
_runner = RCTInitRunnerForApp(@"RNTester/js/RNTesterApp.ios", nil);
|
||||
_runner = RCTInitRunnerForApp(@"RNTester/js/RNTesterApp.ios", nil, nil);
|
||||
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11) {
|
||||
_runner.testSuffix = @"-iOS11";
|
||||
} else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10) {
|
||||
|
|
Loading…
Reference in New Issue