Skip to content

Commit e2b0025

Browse files
committed
Improve clarity of line and branch coverage format.
- Put percentage first and then covered and total counts in brackets afterwards. Percentage is most critical at a quick glance. - Put line and brnach coverage on separate lines. Now it shows in a clean format, including covered branches, total branches and percent of covered branches. Something like this: ``` Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage. Line Coverage: 58.44% (7554 / 12927) Branch Coverage: 50.43% (1868 / 3704) ``` When branch coverage is not enabled it simply omits that line, so it appears like this: ``` Coverage report generated for (1/10), (10/10), (2/10), (3/10), (4/10), (5/10), (6/10), (7/10), (8/10), (9/10) to /Users/me/Development/cntral/coverage. Line Coverage: 58.44% (7554 / 12927) ```
1 parent 1328053 commit e2b0025

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/simplecov-html.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ def format(result)
3838
end
3939

4040
def output_message(result)
41-
str = "Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
42-
str += " #{result.covered_branches} / #{result.total_branches} branches (#{result.coverage_statistics[:branch].percent.round(2)}%) covered." if branchable_result?
43-
str
41+
output = "Coverage report generated for #{result.command_name} to #{output_path}."
42+
output += "\nLine Coverage: #{result.covered_percent.round(2)}% (#{result.covered_lines} / #{result.total_lines})"
43+
output += "\nBranch Coverage: #{result.coverage_statistics[:branch].percent.round(2)}% (#{result.covered_branches} / #{result.total_branches})" if branchable_result?
44+
output
4445
end
4546

4647
def branchable_result?

0 commit comments

Comments
 (0)