Skip to content

Commit

Permalink
Don’t dispatch for non-specta tests
Browse files Browse the repository at this point in the history
The swizzled functionality is causing deadlocks when an XCTestExpectation times out in a project that includes Specta.
  • Loading branch information
MatejBalantic committed Feb 8, 2017
1 parent 5d84618 commit e790900
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Specta/Specta/XCTestCase+Specta.m
Expand Up @@ -42,7 +42,10 @@ - (void)spt_dequeueFailures {
[self spt_dequeueFailures];
};

if ([NSThread isMainThread]) {
BOOL isMainThread = [NSThread isMainThread];
BOOL isSpectaTest = [self isKindOfClass:[SPTSpec class]];

if (!isSpectaTest || isMainThread) {
dequeueFailures();
} else {
dispatch_sync(dispatch_get_main_queue(), dequeueFailures);
Expand Down

0 comments on commit e790900

Please sign in to comment.