Skip to content

Commit

Permalink
Guard against possible race conditions in RCTAllocationTests
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D3829341

fbshipit-source-id: 2a3fd66a7b1494176726a79ef28cef5158d8ad58
  • Loading branch information
frantic authored and Facebook Github Bot 8 committed Sep 8, 2016
1 parent e70d1db commit f1c158e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Examples/UIExplorer/UIExplorerUnitTests/RCTAllocationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ - (void)setUp

NSURL *tempDir = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES];
[[NSFileManager defaultManager] createDirectoryAtURL:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];

_bundleURL = [tempDir URLByAppendingPathComponent:@"rctallocationtests-bundle.js"];
[bundleContents writeToURL:_bundleURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
NSString *guid = [[NSProcessInfo processInfo] globallyUniqueString];
NSString *fileName = [NSString stringWithFormat:@"rctallocationtests-bundle-%@.js", guid];

_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
Expand Down

0 comments on commit f1c158e

Please sign in to comment.