Guard against possible race conditions in RCTAllocationTests
Reviewed By: javache Differential Revision: D3829341 fbshipit-source-id: 2a3fd66a7b1494176726a79ef28cef5158d8ad58
This commit is contained in:
parent
e70d1dba58
commit
f1c158e534
|
@ -85,9 +85,14 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
|
|||
|
||||
NSURL *tempDir = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES];
|
||||
[[NSFileManager defaultManager] createDirectoryAtURL:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||
NSString *fileName = [NSString stringWithFormat:@"rctallocationtests-bundle-%@.js", guid];
|
||||
|
||||
_bundleURL = [tempDir URLByAppendingPathComponent:@"rctallocationtests-bundle.js"];
|
||||
[bundleContents writeToURL:_bundleURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
|
||||
_bundleURL = [tempDir URLByAppendingPathComponent:fileName];
|
||||
NSError *saveError;
|
||||
if (![bundleContents writeToURL:_bundleURL atomically:YES encoding:NSUTF8StringEncoding error:&saveError]) {
|
||||
XCTFail(@"Failed to save test bundle to %@, error: %@", _bundleURL, saveError);
|
||||
};
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
|
|
Loading…
Reference in New Issue