Repository: cpisciotta/xcbeautify
Pull request #371 (2025-02-10 03:08:16)

Delete Duplicate TestSuiteStartCaptureGroup
Consolidate with TestSuiteStartedCaptureGroup.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/371?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) Report
Attention: Patch coverage is `66.66667%` with `1 line` in your changes missing coverage. Please review.
> Project coverage is 85.49%. Comparing base [(`577fc8d`)](https://app.codecov.io/gh/cpisciotta/xcbeautify/commit/577fc8dc7c3dd3a7ee5b698184677f12e7da7b22?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) to head [(`32c74f4`)](https://app.codecov.io/gh/cpisciotta/xcbeautify/commit/32c74f4dd591701a4e36af1cddd8454a0a1c0200?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta).

| [Files with missing lines](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/371?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) | Patch % | Lines |
|---|---|---|
| [...rces/XcbeautifyLib/Renderers/OutputRendering.swift](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/371?src=pr&el=tree&filepath=Sources%2FXcbeautifyLib%2FRenderers%2FOutputRendering.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta#diff-U291cmNlcy9YY2JlYXV0aWZ5TGliL1JlbmRlcmVycy9PdXRwdXRSZW5kZXJpbmcuc3dpZnQ=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/371?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) |

> :exclamation:  There is a different number of reports uploaded between BASE (577fc8d) and HEAD (32c74f4). Click for more details.
> 
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (577fc8d) | HEAD (32c74f4) |
>|------|------|------|
>||2|1|
></details>

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main     #371      +/-   ##
==========================================
- Coverage   90.51%   85.49%   -5.02%     
==========================================
  Files          17       17              
  Lines        2468     2455      -13     
==========================================
- Hits         2234     2099     -135     
- Misses        234      356     +122     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/371?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta).


Patch:
diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift
index 1f39286..8fb554f 100644
--- a/Sources/XcbeautifyLib/CaptureGroups.swift
+++ b/Sources/XcbeautifyLib/CaptureGroups.swift
@@ -1318,41 +1318,21 @@ struct TestSuiteStartedCaptureGroup: CaptureGroup {
     static let outputType: OutputType = .test
 
     /// Regular expression captured groups:
-    /// $1 = suite
+    /// $1 = suite name
     /// $2 = time
-    #if os(Linux)
-    static let regex = XCRegex(pattern: #"^\s*Test Suite '(.*)' started at(.*)"#)
-    #else
-    static let regex = XCRegex(pattern: #"^\s*Test Suite '(?:.*\/)?(.*[ox]ctest.*)' started at(.*)"#)
-    #endif
+    static let regex = XCRegex(pattern: #"^\s*Test Suite '(.*)' started at (.*)$"#)
 
-    let suite: String
+    let suiteName: String
     let time: String
 
     init?(groups: [String]) {
-        assert(groups.count >= 2)
-        guard let suite = groups[safe: 0], let time = groups[safe: 1] else { return nil }
-        self.suite = suite
+        assert(groups.count == 2)
+        guard let suiteName = groups[safe: 0], let time = groups[safe: 1] else { return nil }
+        self.suiteName = suiteName
         self.time = time
     }
 }
 
-struct TestSuiteStartCaptureGroup: CaptureGroup {
-    static let outputType: OutputType = .test
-
-    /// Regular expression captured groups:
-    /// $1 = test suite name
-    static let regex = XCRegex(pattern: #"^\s*Test Suite '(.*)' started at"#)
-
-    let testSuiteName: String
-
-    init?(groups: [String]) {
-        assert(groups.count >= 1)
-        guard let testSuiteName = groups[safe: 0] else { return nil }
-        self.testSuiteName = testSuiteName
-    }
-}
-
 struct TestSuiteAllTestsPassedCaptureGroup: CaptureGroup {
     static let outputType: OutputType = .result
     static let regex = XCRegex(pattern: #"^\s*(Test Suite 'All tests' passed at.*)"#)
diff --git a/Sources/XcbeautifyLib/Formatter.swift b/Sources/XcbeautifyLib/Formatter.swift
index f2302e8..b4684c8 100644
--- a/Sources/XcbeautifyLib/Formatter.swift
+++ b/Sources/XcbeautifyLib/Formatter.swift
@@ -204,8 +204,6 @@ package struct Formatter {
             return renderer.formatTestSuiteAllTestsFailed(group: group)
         case let group as TestSuiteAllTestsPassedCaptureGroup:
             return renderer.formatTestSuiteAllTestsPassed(group: group)
-        case let group as TestSuiteStartCaptureGroup:
-            return renderer.formatTestSuiteStart(group: group)
         case let group as TestSuiteStartedCaptureGroup:
             return renderer.formatTestSuiteStarted(group: group)
         case let group as TIFFutilCaptureGroup:
diff --git a/Sources/XcbeautifyLib/JunitReporter.swift b/Sources/XcbeautifyLib/JunitReporter.swift
index 314111e..3db13dc 100644
--- a/Sources/XcbeautifyLib/JunitReporter.swift
+++ b/Sources/XcbeautifyLib/JunitReporter.swift
@@ -35,7 +35,7 @@ package final class JunitReporter {
         } else if let groups = TestCaseSkippedCaptureGroup.regex.captureGroups(for: line) {
             guard let testCase = generateSkippedTest(groups: groups) else { return }
             components.append(.skippedTest(testCase))
-        } else if let groups = TestSuiteStartCaptureGroup.regex.captureGroups(for: line) {
+        } else if let groups = TestSuiteStartedCaptureGroup.regex.captureGroups(for: line) {
             guard let testStart = generateSuiteStart(groups: groups) else { return }
             components.append(.testSuiteStart(testStart))
         } else if let groups = ParallelTestCaseFailedCaptureGroup.regex.captureGroups(for: line) {
@@ -91,8 +91,8 @@ package final class JunitReporter {
     }
 
     private func generateSuiteStart(groups: [String]) -> String? {
-        guard let group = TestSuiteStartCaptureGroup(groups: groups) else { return nil }
-        return group.testSuiteName
+        guard let group = TestSuiteStartedCaptureGroup(groups: groups) else { return nil }
+        return group.suiteName
     }
 
     package func generateReport() throws -> Data {
diff --git a/Sources/XcbeautifyLib/Parser.swift b/Sources/XcbeautifyLib/Parser.swift
index aa94dc1..1e84296 100644
--- a/Sources/XcbeautifyLib/Parser.swift
+++ b/Sources/XcbeautifyLib/Parser.swift
@@ -52,7 +52,6 @@ package final class Parser {
         ProcessInfoPlistCaptureGroup.self,
         TestsRunCompletionCaptureGroup.self,
         TestSuiteStartedCaptureGroup.self,
-        TestSuiteStartCaptureGroup.self,
         TIFFutilCaptureGroup.self,
         TouchCaptureGroup.self,
         WriteFileCaptureGroup.self,
diff --git a/Sources/XcbeautifyLib/Renderers/OutputRendering.swift b/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
index ae5237c..efad686 100644
--- a/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
+++ b/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
@@ -80,7 +80,6 @@ protocol OutputRendering {
     func formatTestsRunCompletion(group: TestsRunCompletionCaptureGroup) -> String
     func formatTestSuiteAllTestsFailed(group: TestSuiteAllTestsFailedCaptureGroup) -> String
     func formatTestSuiteAllTestsPassed(group: TestSuiteAllTestsPassedCaptureGroup) -> String
-    func formatTestSuiteStart(group: TestSuiteStartCaptureGroup) -> String
     func formatTestSuiteStarted(group: TestSuiteStartedCaptureGroup) -> String
     func formatTIFFUtil(group: TIFFutilCaptureGroup) -> String?
     func formatTouch(group: TouchCaptureGroup) -> String
@@ -387,15 +386,8 @@ extension OutputRendering {
         group.wholeResult
     }
 
-    func formatTestSuiteStart(group: TestSuiteStartCaptureGroup) -> String {
-        let testSuite = group.testSuiteName
-        return colored ? testSuite.s.Bold : testSuite
-    }
-
     func formatTestSuiteStarted(group: TestSuiteStartedCaptureGroup) -> String {
-        let testSuite = group.suite
-        let heading = "Test Suite \(testSuite) started"
-        return colored ? heading.s.Bold.f.Cyan : heading
+        "Test Suite '\(group.suiteName)' started at \(group.time)"
     }
 
     func formatTIFFUtil(group: TIFFutilCaptureGroup) -> String? {


Test patch:
diff --git a/Tests/XcbeautifyLibTests/RendererTests/AzureDevOpsPipelinesRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/AzureDevOpsPipelinesRendererTests.swift
index b614fa7..a3d5d13 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/AzureDevOpsPipelinesRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/AzureDevOpsPipelinesRendererTests.swift
@@ -491,9 +491,11 @@ final class AzureDevOpsPipelinesRendererTests: XCTestCase {
 
     func testTestCaseStarted() { }
 
-    func testTestSuiteStart() { }
-
-    func testTestSuiteStarted() { }
+    func testTestSuiteStarted() {
+        let input = "Test Suite 'swift-testingPackageTests.xctest' started at 2024-10-09 16:48:58.588."
+        let formatted = logFormatted(input)
+        XCTAssertEqual(formatted, input)
+    }
 
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {
diff --git a/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift
index 8bb7ba5..edc8820 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift
@@ -488,9 +488,11 @@ final class GitHubActionsRendererTests: XCTestCase {
 
     func testTestCaseStarted() { }
 
-    func testTestSuiteStart() { }
-
-    func testTestSuiteStarted() { }
+    func testTestSuiteStarted() {
+        let input = "Test Suite 'swift-testingPackageTests.xctest' started at 2024-10-09 16:48:58.588."
+        let formatted = logFormatted(input)
+        XCTAssertEqual(formatted, input)
+    }
 
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {
diff --git a/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift
index cc9d87e..7289c83 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift
@@ -509,9 +509,11 @@ final class TeamCityRendererTests: XCTestCase {
 
     func testTestCaseStarted() { }
 
-    func testTestSuiteStart() { }
-
-    func testTestSuiteStarted() { }
+    func testTestSuiteStarted() {
+        let input = "Test Suite 'swift-testingPackageTests.xctest' started at 2024-10-09 16:48:58.588."
+        let formatted = noColoredFormatted(input)
+        XCTAssertEqual(formatted, input)
+    }
 
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {
diff --git a/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
index 6ea210f..6d44891 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
@@ -488,9 +488,11 @@ final class TerminalRendererTests: XCTestCase {
 
     func testTestCaseStarted() { }
 
-    func testTestSuiteStart() { }
-
-    func testTestSuiteStarted() { }
+    func testTestSuiteStarted() {
+        let input = "Test Suite 'swift-testingPackageTests.xctest' started at 2024-10-09 16:48:58.588."
+        let formatted = noColoredFormatted(input)
+        XCTAssertEqual(formatted, input)
+    }
 
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {