diff --git a/Libraries/RCTTest/RCTTestModule.m b/Libraries/RCTTest/RCTTestModule.m index c5741e93df2..dd2424d31dd 100644 --- a/Libraries/RCTTest/RCTTestModule.m +++ b/Libraries/RCTTest/RCTTestModule.m @@ -51,6 +51,9 @@ RCT_EXPORT_METHOD(verifySnapshot:(RCTResponseSenderBlock)callback) selector:self->_testSelector identifier:identifier error:&error]; + if (!success) { + RCTLogInfo(@"Failed to verify snapshot %@ (error: %@)", identifier, error); + } callback(@[@(success)]); }]; } diff --git a/Libraries/RCTTest/RCTTestRunner.m b/Libraries/RCTTest/RCTTestRunner.m index 6f3ed05631c..e32af66bc33 100644 --- a/Libraries/RCTTest/RCTTestRunner.m +++ b/Libraries/RCTTest/RCTTestRunner.m @@ -97,9 +97,12 @@ expectErrorBlock:(BOOL(^)(NSString *error))expectErrorBlock { @autoreleasepool { __block NSString *error = nil; + RCTLogFunction defaultLogFunction = RCTGetLogFunction(); RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { if (level >= RCTLogLevelError) { error = message; + } else { + defaultLogFunction(level, source, fileName, lineNumber, message); } }); @@ -137,7 +140,7 @@ expectErrorBlock:(BOOL(^)(NSString *error))expectErrorBlock [rootView removeFromSuperview]; - RCTSetLogFunction(RCTDefaultLogFunction); + RCTSetLogFunction(defaultLogFunction); NSArray *nonLayoutSubviews = [vc.view.subviews filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id subview, NSDictionary *bindings) { return ![NSStringFromClass([subview class]) isEqualToString:@"_UILayoutGuide"];