From 7d8437608e7ba37f7dbd0561d25210ff30c4e099 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 4 Feb 2021 12:35:55 -0500 Subject: [PATCH] Add JSONFormatter explicitly --- Library/Homebrew/test/spec_helper.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) 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"