Actually report test failures when running in Chrome

Turns out Chrome doesn't report back exceptions, but instead does pass back an array of five empty arrays (I am not kidding).
This commit is contained in:
Scott Kyle 2015-10-23 14:13:38 -07:00
parent e7b05d2dc6
commit 1ede355b78

View File

@ -147,6 +147,15 @@ extern void JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions(JSG
__block id result;
[executor executeJSCall:module method:method arguments:@[] callback:^(id json, NSError *error) {
// The React Native debuggerWorker.js very bizarrely returns an array five empty arrays to signify an error.
if ([json isKindOfClass:[NSArray class]] && [json isEqualToArray:@[@[], @[], @[], @[], @[]]]) {
json = nil;
if (!error) {
error = [NSError errorWithDomain:@"JS" code:1 userInfo:@{NSLocalizedDescriptionKey: @"unknown JS error"}];
}
}
dispatch_async(dispatch_get_main_queue(), ^{
condition = YES;
result = json;