mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
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:
committed by
Facebook Github Bot
parent
a6bdacb257
commit
0bde29e197
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user