Skip to content

Commit 6bacdb9

Browse files
committed
Suppress ExpectationFailedError in withKnownIssue
1 parent 59dc7f5 commit 6bacdb9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/Testing/Issues/KnownIssue.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ private func _combineIssueMatcher(_ issueMatcher: @escaping KnownIssueMatcher, m
4141
/// - sourceLocation: The source location to which the issue should be
4242
/// attributed.
4343
private func _matchError(_ error: any Error, using issueMatcher: KnownIssueMatcher, comment: Comment?, sourceLocation: SourceLocation) throws {
44+
if error is ExpectationFailedError {
45+
// An `ExpectationFailedError` instance was thrown through the call to
46+
// `withKnownIssue {}` from a call to `#require()`. The original issue (of
47+
// kind `expectationFailed`) will have already been handled by this point,
48+
// so we don't want to try to handle it again.
49+
throw error
50+
}
51+
4452
let sourceContext = SourceContext(backtrace: Backtrace(forFirstThrowOf: error), sourceLocation: sourceLocation)
4553
var issue = Issue(kind: .errorCaught(error), comments: Array(comment), sourceContext: sourceContext)
4654
if issueMatcher(issue) {

0 commit comments

Comments
 (0)