Skip to content

Commit ceb99b9

Browse files
authored
Count issues recorded without known tests. (#593)
This PR ensures that the total issue count presented at the end of a test run includes issues that aren't attributable to specific tests. Refines #592. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 15892d8 commit ceb99b9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,18 @@ extension Event.HumanReadableOutputRecorder {
262262
}
263263

264264
case let .issueRecorded(issue):
265-
if let test {
266-
let id = test.id.keyPathRepresentation
267-
var testData = context.testData[id] ?? .init(startInstant: instant)
268-
if issue.isKnown {
269-
testData.knownIssueCount += 1
270-
} else {
271-
testData.issueCount += 1
272-
}
273-
context.testData[id] = testData
265+
let id: [String] = if let test {
266+
test.id.keyPathRepresentation
267+
} else {
268+
[]
269+
}
270+
var testData = context.testData[id] ?? .init(startInstant: instant)
271+
if issue.isKnown {
272+
testData.knownIssueCount += 1
273+
} else {
274+
testData.issueCount += 1
274275
}
276+
context.testData[id] = testData
275277

276278
default:
277279
// These events do not manipulate the context structure.

0 commit comments

Comments
 (0)