Skip to content

Commit 31d9715

Browse files
committed
Fix formattedSummary
1 parent f4113c4 commit 31d9715

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Sources/XcbeautifyLib/Parser.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ package class Parser {
170170

171171
package func formattedSummary() -> String? {
172172
guard let summary else { return nil }
173-
return nil
174-
// return renderer.format(testSummary: summary)
173+
return summary.formatted(renderer: renderer, colored: colored)
175174
}
176175

177176
// MARK: Private

Sources/XcbeautifyLib/TestSummary.swift

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Colorizer
2+
13
struct TestSummary {
24
let testsCount: Int
35
let skippedCount: Int
@@ -19,6 +21,23 @@ struct TestSummary {
1921
time: left.time + right.time
2022
)
2123
}
24+
25+
func formatted(renderer: Renderer, colored: Bool) -> String {
26+
switch renderer {
27+
case .terminal:
28+
if isSuccess() {
29+
return colored ? "Tests Passed: \(description)".s.Bold.f.Green : "Tests Passed: \(description)"
30+
} else {
31+
return colored ? "Tests Failed: \(description)".s.Bold.f.Red : "Tests Failed: \(description)"
32+
}
33+
case .gitHubActions:
34+
if isSuccess() {
35+
return "::notice::Tests Passed: \(description)"
36+
} else {
37+
return "::error::Tests Failed: \(description)"
38+
}
39+
}
40+
}
2241
}
2342

2443
extension TestSummary {

0 commit comments

Comments
 (0)