@@ -117,12 +117,15 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName
117
117
__weak RCTBridge *batchedBridge;
118
118
119
119
@autoreleasepool {
120
- __block NSString *error = nil ;
120
+ __block NSMutableArray < NSString *> *errors = nil ;
121
121
RCTLogFunction defaultLogFunction = RCTGetLogFunction ();
122
122
RCTSetLogFunction (^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
123
123
defaultLogFunction (level, source, fileName, lineNumber, message);
124
124
if (level >= RCTLogLevelError) {
125
- error = message;
125
+ if (errors == nil ) {
126
+ errors = [NSMutableArray new ];
127
+ }
128
+ [errors addObject: message];
126
129
}
127
130
});
128
131
@@ -155,7 +158,7 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName
155
158
}
156
159
157
160
NSDate *date = [NSDate dateWithTimeIntervalSinceNow: kTestTimeoutSeconds ];
158
- while (date.timeIntervalSinceNow > 0 && testModule.status == RCTTestStatusPending && error == nil ) {
161
+ while (date.timeIntervalSinceNow > 0 && testModule.status == RCTTestStatusPending && errors == nil ) {
159
162
[[NSRunLoop mainRunLoop ] runMode: NSDefaultRunLoopMode beforeDate: [NSDate dateWithTimeIntervalSinceNow: 0.1 ]];
160
163
[[NSRunLoop mainRunLoop ] runMode: NSRunLoopCommonModes beforeDate: [NSDate dateWithTimeIntervalSinceNow: 0.1 ]];
161
164
}
@@ -173,9 +176,9 @@ - (void)runTest:(SEL)test module:(NSString *)moduleName
173
176
#endif
174
177
175
178
if (expectErrorBlock) {
176
- RCTAssert (expectErrorBlock (error ), @" Expected an error but nothing matched ." );
179
+ RCTAssert (expectErrorBlock (errors[ 0 ] ), @" Expected an error but the first one was missing or did not match ." );
177
180
} else {
178
- RCTAssert (error == nil , @" RedBox error : %@ " , error );
181
+ RCTAssert (errors == nil , @" RedBox errors : %@ " , errors );
179
182
RCTAssert (testModule.status != RCTTestStatusPending, @" Test didn't finish within %0.f seconds" , kTestTimeoutSeconds );
180
183
RCTAssert (testModule.status == RCTTestStatusPassed, @" Test failed" );
181
184
}
0 commit comments