Consider SSTs in Platform.isTesting

Summary:
A common util from RN to gate on testing code is `Platform.isTesting()`

Unfortunately, this util does not account for ServerSnapshotTests, since they don't use apple's XCTest infra.

Reviewed By: sahrens

Differential Revision: D13981728

fbshipit-source-id: bf902a04f5d7fcb98a06816f5c2c9b082e7d14b8
This commit is contained in:
Peter Argany authored and Facebook Github Bot committed 2019-02-07 11:07:17 -08:00
1 parent a6bdacb257
commit 0bde29e197
1 file changed
+4 -2
+4 -2
View File
@@ -458,8 +458,10 @@ BOOL RCTRunningInTestEnvironment(void)
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
isTestEnvironment = objc_lookUpClass("SenTestCase") || objc_lookUpClass("XCTest") ||
[environment[@"IS_TESTING"] boolValue];
isTestEnvironment = objc_lookUpClass("SenTestCase") ||
objc_lookUpClass("XCTest") ||
objc_lookUpClass("SnapshotTestAppDelegate") ||
[environment[@"IS_TESTING"] boolValue];
});
return isTestEnvironment;
}