Permalink
Browse files

Merge RCTPlatform.isTesting and RCTRunningInTestEnvironment

Reviewed By: fkgozali

Differential Revision: D4802834

fbshipit-source-id: 76bb98877f2fc427c01806b192d8dc71489a1c4a
  • Loading branch information...
javache authored and facebook-github-bot committed Mar 30, 2017
1 parent 5af3038 commit f6754348be617e9e6d79865e24894af0bd027ee0
Showing with 6 additions and 10 deletions.
  1. +1 −6 React/Base/RCTPlatform.m
  2. +5 −4 React/Base/RCTUtils.m
View
@@ -30,11 +30,6 @@ @implementation RCTPlatform
}
}
static BOOL isTestingEnvironment(void) {
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
return [environment[@"IS_TESTING"] boolValue];
}
RCT_EXPORT_MODULE(PlatformConstants)
- (NSDictionary<NSString *, id> *)constantsToExport
@@ -45,7 +40,7 @@ static BOOL isTestingEnvironment(void) {
@"osVersion": [device systemVersion],
@"systemName": [device systemName],
@"interfaceIdiom": interfaceIdiom([device userInterfaceIdiom]),
@"isTesting": @(isTestingEnvironment()),
@"isTesting": @(RCTRunningInTestEnvironment()),
};
}
View
@@ -9,17 +9,16 @@
#import "RCTUtils.h"
#import <dlfcn.h>
#import <mach/mach_time.h>
#import <objc/message.h>
#import <objc/runtime.h>
#import <zlib.h>
#import <UIKit/UIKit.h>
#import <CommonCrypto/CommonCrypto.h>
#import <zlib.h>
#import <dlfcn.h>
#import "RCTAssert.h"
#import "RCTLog.h"
@@ -445,7 +444,9 @@ BOOL RCTRunningInTestEnvironment(void)
static BOOL isTestEnvironment = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
isTestEnvironment = objc_lookUpClass("SenTestCase") || objc_lookUpClass("XCTest");
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
isTestEnvironment = objc_lookUpClass("SenTestCase") || objc_lookUpClass("XCTest") ||
[environment[@"IS_TESTING"] boolValue];
});
return isTestEnvironment;
}

0 comments on commit f675434

Please sign in to comment.