From 93c771d3758f8ba31382de84b96277bc873ee1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 14 Jan 2020 21:43:56 +0100 Subject: [PATCH] Don't combine branches if branch coverage not enabled --- lib/simplecov/combine/files_combiner.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/simplecov/combine/files_combiner.rb b/lib/simplecov/combine/files_combiner.rb index 4732761a..e5c4ef39 100644 --- a/lib/simplecov/combine/files_combiner.rb +++ b/lib/simplecov/combine/files_combiner.rb @@ -15,10 +15,9 @@ module FilesCombiner # @return [Hash] # def combine(coverage_a, coverage_b) - { - lines: Combine.combine(LinesCombiner, coverage_a[:lines], coverage_b[:lines]), - branches: Combine.combine(BranchesCombiner, coverage_a[:branches], coverage_b[:branches]) - } + combination = {lines: Combine.combine(LinesCombiner, coverage_a[:lines], coverage_b[:lines])} + combination[:branches] = Combine.combine(BranchesCombiner, coverage_a[:branches], coverage_b[:branches]) if SimpleCov.branch_coverage? + combination end end end