Skip to content

Commit 01e3ea1

Browse files
committed
coverage: report branch coverage
1 parent 8e98c75 commit 01e3ea1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/spec_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
SimpleCov.start do
55
enable_coverage :branch
66
end
7+
8+
SimpleCov.at_exit do
9+
SimpleCov.result.format!
10+
11+
result = SimpleCov.result
12+
if result.total_branches&.positive?
13+
covered_branches_percent = 100.0 * result.covered_branches / result.total_branches
14+
puts "Branch coverage: #{result.covered_branches} / #{result.total_branches} branches (#{covered_branches_percent.round(2)}%) covered."
15+
end
16+
end
717
end
818

919
require 'rubygems'

0 commit comments

Comments
 (0)