Skip to content

Commit ee44930

Browse files
committed
[ReactNative] Fail faster in OSS tests
1 parent d177a45 commit ee44930

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

Examples/SampleApp/SampleAppTests/SampleAppTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ - (void)testRendersWelcomeScreen {
4444
NSString *redboxError = nil;
4545

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

5050
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
5151

Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ - (void)testAAA_RootViewLoadsAndRenders
6969
NSString *redboxError = nil;
7070

7171
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
72-
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
73-
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
72+
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
73+
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
74+
7475
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
7576
foundElement = [self findSubviewInView:vc.view matching:^(UIView *view) {
7677
if ([view respondsToSelector:@selector(attributedText)]) {

Libraries/RCTTest/RCTTestRunner.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictiona
8484
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
8585
NSString *error = [[RCTRedBox sharedInstance] currentErrorMessage];
8686
while ([date timeIntervalSinceNow] > 0 && ![testModule isDone] && error == nil) {
87-
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
88-
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
87+
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
88+
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
8989
error = [[RCTRedBox sharedInstance] currentErrorMessage];
9090
}
9191
[rootView removeFromSuperview];

0 commit comments

Comments
 (0)