From 8ba79d1ed4148f8d3866d8e283d1164e3a407bfe Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 18 Sep 2020 09:54:12 -0700 Subject: [PATCH] Print branch coverage with line coverage Almost everyone using branch coverage is going to want to see the branch coverage and the line coverage output. --- lib/simplecov-html.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/simplecov-html.rb b/lib/simplecov-html.rb index 56073d2..3f9c71e 100644 --- a/lib/simplecov-html.rb +++ b/lib/simplecov-html.rb @@ -32,7 +32,11 @@ def format(result) end def output_message(result) - "Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered." + str = "Coverage report generated for #{result.command_name} to #{output_path}. #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered." + if branchable_result? + str += " #{result.covered_branches} / #{result.total_branches} branches (#{result.coverage_statistics[:branch].percent.round(2)}%) covered." + end + str end def branchable_result?