Switch out DISABLE_YELLOW_BOX for IS_TESTING

Summary: Switch to using IS_TESTING on the Platform module. While IS_TESTING has to be explicitly set in the test harness, this makes it more usable and stops people from relying on brittle variables in the (larger) environment.

Reviewed By: fkgozali

Differential Revision: D4423661

fbshipit-source-id: 27a80867778b9374bcba67b69f9c93d32c0a74b0
This commit is contained in:
Mehdi Mulani
2017-01-18 12:24:53 -08:00
committed by Facebook Github Bot
parent a4bfac907e
commit 81c33b542d
6 changed files with 12 additions and 44 deletions

View File

@@ -30,6 +30,11 @@ static NSString *interfaceIdiom(UIUserInterfaceIdiom idiom) {
}
}
static BOOL isTestingEnvironment(void) {
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
return [environment[@"IS_TESTING"] boolValue];
}
RCT_EXPORT_MODULE(IOSConstants)
- (NSDictionary<NSString *, id> *)constantsToExport
@@ -40,6 +45,7 @@ RCT_EXPORT_MODULE(IOSConstants)
@"osVersion": [device systemVersion],
@"systemName": [device systemName],
@"interfaceIdiom": interfaceIdiom([device userInterfaceIdiom]),
@"isTesting": @(isTestingEnvironment()),
};
}