Skip to content

Commit

Permalink
Fixed release builds on UIExplorer
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklockwood committed Apr 22, 2015
1 parent 368e507 commit b1a1500
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/RCTTest/RCTTestModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import <UIKit/UIKit.h>

#import "RCTBridgeModule.h"
#import "RCTDefines.h"

@class FBSnapshotTestController;

Expand Down
10 changes: 10 additions & 0 deletions Libraries/RCTTest/RCTTestRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "RCTTestRunner.h"

#import "FBSnapshotTestController.h"
#import "RCTDefines.h"
#import "RCTRedBox.h"
#import "RCTRootView.h"
#import "RCTTestModule.h"
Expand Down Expand Up @@ -75,6 +76,8 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictiona
vc.view = [[UIView alloc] init];
[vc.view addSubview:rootView]; // Add as subview so it doesn't get resized

#if RCT_DEBUG // Prevents build errors, as RCTRedBox is underfined if RCT_DEBUG=0

NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
NSString *error = [[RCTRedBox sharedInstance] currentErrorMessage];
while ([date timeIntervalSinceNow] > 0 && ![testModule isDone] && error == nil) {
Expand All @@ -95,6 +98,13 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictiona
} else {
RCTAssert([testModule isDone], @"Test didn't finish within %d seconds", TIMEOUT_SECONDS);
}

#else

expectErrorBlock(@"RCTRedBox unavailable. Set RCT_DEBUG=1 for testing.");

#endif

}

@end

0 comments on commit b1a1500

Please sign in to comment.