Skip to content

Commit

Permalink
[ReactNative] Fail faster in OSS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frantic committed May 6, 2015
1 parent 286e1b0 commit 735f673
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Examples/SampleApp/SampleAppTests/SampleAppTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ - (void)testRendersWelcomeScreen {
NSString *redboxError = nil;

while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];

redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];

Expand Down
5 changes: 3 additions & 2 deletions Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ - (void)testAAA_RootViewLoadsAndRenders
NSString *redboxError = nil;

while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];

redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
foundElement = [self findSubviewInView:vc.view matching:^(UIView *view) {
if ([view respondsToSelector:@selector(attributedText)]) {
Expand Down
4 changes: 2 additions & 2 deletions Libraries/RCTTest/RCTTestRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictiona
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
NSString *error = [[RCTRedBox sharedInstance] currentErrorMessage];
while ([date timeIntervalSinceNow] > 0 && ![testModule isDone] && error == nil) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
error = [[RCTRedBox sharedInstance] currentErrorMessage];
}
[rootView removeFromSuperview];
Expand Down

0 comments on commit 735f673

Please sign in to comment.