mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 17:33:15 +08:00
Support optional bundle prefix in RNTester integration tests
Summary: Add support for a `CI_USE_BUNDLE_PREFIX` envvar in the RNTester Xcode scheme, as part of ongoing work to enable integration tests in Facebook's internal CI system. [iOS] [Added] - Add new envvar to support internal iOS tests at Facebook Reviewed By: cpojer Differential Revision: D15163397 fbshipit-source-id: 1b75b1868b5f9721a69f6cba4d4052be47e5e5e2
This commit is contained in:
committed by
Facebook Github Bot
parent
28e0de070d
commit
e94b116d76
@@ -87,7 +87,11 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
|
||||
- (NSURL *)defaultScriptURL
|
||||
{
|
||||
if (getenv("CI_USE_PACKAGER") || _useBundler) {
|
||||
return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=ios&dev=true", _appPath]];
|
||||
NSString *bundlePrefix = @"";
|
||||
if (getenv("CI_USE_BUNDLE_PREFIX")) {
|
||||
bundlePrefix = @"react-native-github/";
|
||||
}
|
||||
return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@%@.bundle?platform=ios&dev=true", bundlePrefix, _appPath]];
|
||||
} else {
|
||||
return [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"];
|
||||
}
|
||||
|
||||
@@ -143,6 +143,11 @@
|
||||
value = "1"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "CI_USE_BUNDLE_PREFIX"
|
||||
value = "0"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
|
||||
@@ -67,21 +67,21 @@
|
||||
|
||||
_bridge = [[RCTBridge alloc] initWithDelegate:self
|
||||
launchOptions:launchOptions];
|
||||
|
||||
|
||||
// Appetizer.io params check
|
||||
NSDictionary *initProps = @{};
|
||||
NSString *_routeUri = [[NSUserDefaults standardUserDefaults] stringForKey:@"route"];
|
||||
if (_routeUri) {
|
||||
initProps = @{@"exampleFromAppetizeParams": [NSString stringWithFormat:@"rntester://example/%@Example", _routeUri]};
|
||||
}
|
||||
|
||||
|
||||
#ifdef RN_FABRIC_ENABLED
|
||||
// FIXME: remove when resolved https://github.com/facebook/react-native/issues/23910
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(handleJavaScriptDidLoadNotification:)
|
||||
name:RCTJavaScriptDidLoadNotification
|
||||
object:_bridge];
|
||||
|
||||
|
||||
_surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge config:nil];
|
||||
_bridge.surfacePresenter = _surfacePresenter;
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
#else
|
||||
UIView *rootView = [[RCTRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
|
||||
#endif
|
||||
|
||||
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
UIViewController *rootViewController = [UIViewController new];
|
||||
rootViewController.view = rootView;
|
||||
@@ -109,7 +109,12 @@
|
||||
|
||||
- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge
|
||||
{
|
||||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"RNTester/js/RNTesterApp.ios"
|
||||
NSString *bundlePrefix = @"";
|
||||
if (getenv("CI_USE_BUNDLE_PREFIX")) {
|
||||
bundlePrefix = @"react-native-github/";
|
||||
}
|
||||
NSString *bundleRoot = [NSString stringWithFormat:@"%@RNTester/js/RNTesterApp.ios", bundlePrefix];
|
||||
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:bundleRoot
|
||||
fallbackResource:nil];
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,12 @@
|
||||
{
|
||||
NSURL *scriptURL;
|
||||
if (getenv("CI_USE_PACKAGER")) {
|
||||
NSString *bundlePrefix = @"";
|
||||
if (getenv("CI_USE_BUNDLE_PREFIX")) {
|
||||
bundlePrefix = @"react-native-github/";
|
||||
}
|
||||
NSString *app = @"IntegrationTests/IntegrationTestsApp";
|
||||
scriptURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=ios&dev=true", app]];
|
||||
scriptURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@%@.bundle?platform=ios&dev=true", bundlePrefix, app]];
|
||||
} else {
|
||||
scriptURL = [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user