diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 5726204417..ea57b47c22 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -3,22 +3,17 @@ if ENV["HOMEBREW_TESTS_COVERAGE"] require "simplecov" + require "simplecov_json_formatter" - formatters = [SimpleCov::Formatter::HTMLFormatter] - if RUBY_PLATFORM[/darwin/] - require "simplecov_json_formatter" + formatters = [SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::JSONFormatter] + SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters) - formatters << SimpleCov::Formatter::JSONFormatter - - if ENV["TEST_ENV_NUMBER"] - SimpleCov.at_exit do - result = SimpleCov.result - result.format! if ParallelTests.number_of_running_processes <= 1 - end + if RUBY_PLATFORM[/darwin/] && ENV["TEST_ENV_NUMBER"] + SimpleCov.at_exit do + result = SimpleCov.result + result.format! if ParallelTests.number_of_running_processes <= 1 end end - - SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters) end require "rspec/its"