From 5dc374090467f11cb2c8166700fbc48fe69d179a Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Fri, 28 Feb 2025 15:23:06 -0600 Subject: [PATCH 1/2] JUnit XML recorder should ignore warning issues --- .../Recorder/Event.JUnitXMLRecorder.swift | 2 +- Tests/TestingTests/EventRecorderTests.swift | 17 +++++++++++++++++ .../TestSupport/TestingAdditions.swift | 6 +++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Sources/Testing/Events/Recorder/Event.JUnitXMLRecorder.swift b/Sources/Testing/Events/Recorder/Event.JUnitXMLRecorder.swift index 0b9b283e3..c761753d2 100644 --- a/Sources/Testing/Events/Recorder/Event.JUnitXMLRecorder.swift +++ b/Sources/Testing/Events/Recorder/Event.JUnitXMLRecorder.swift @@ -122,7 +122,7 @@ extension Event.JUnitXMLRecorder { } return nil case let .issueRecorded(issue): - if issue.isKnown { + if issue.isKnown || issue.severity < .error { return nil } if let id = test?.id { diff --git a/Tests/TestingTests/EventRecorderTests.swift b/Tests/TestingTests/EventRecorderTests.swift index 7712cd973..92e669190 100644 --- a/Tests/TestingTests/EventRecorderTests.swift +++ b/Tests/TestingTests/EventRecorderTests.swift @@ -477,6 +477,23 @@ struct EventRecorderTests { } _ = recorder.record(event, in: context) } + + @Test("JUnitXMLRecorder ignores warning issues") + func junitRecorderIgnoresWarningIssues() async throws { + let issue = Issue(kind: .unconditional, severity: .warning) + let context = Event.Context(test: nil, testCase: nil, configuration: nil) + + await confirmation { wroteTestSuite in + let recorder = Event.JUnitXMLRecorder { string in + if string.contains(" Date: Fri, 28 Feb 2025 15:23:52 -0600 Subject: [PATCH 2/2] Fix a pre-existing test which I noticed wasn't actually working as intended --- Tests/TestingTests/EventRecorderTests.swift | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Tests/TestingTests/EventRecorderTests.swift b/Tests/TestingTests/EventRecorderTests.swift index 92e669190..8ac7f6728 100644 --- a/Tests/TestingTests/EventRecorderTests.swift +++ b/Tests/TestingTests/EventRecorderTests.swift @@ -467,15 +467,18 @@ struct EventRecorderTests { @Test("JUnitXMLRecorder counts issues without associated tests") func junitRecorderCountsIssuesWithoutTests() async throws { let issue = Issue(kind: .unconditional) - let event = Event(.issueRecorded(issue), testID: nil, testCaseID: nil) let context = Event.Context(test: nil, testCase: nil, configuration: nil) - let recorder = Event.JUnitXMLRecorder { string in - if string.contains("