diff --git a/test/support/simplecov.rb b/test/support/simplecov.rb new file mode 100644 index 000000000..169f5c8b2 --- /dev/null +++ b/test/support/simplecov.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require "simplecov" if ENV["NOCOV"].nil? && Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6.a") diff --git a/test/support/utils.rb b/test/support/utils.rb index 0146cc932..a8e74f348 100644 --- a/test/support/utils.rb +++ b/test/support/utils.rb @@ -253,14 +253,17 @@ def shell_out_env(simplecov: true) location.label.start_with?("test_") end - byebug_dir = File.absolute_path(File.join("..", "..", "lib"), __dir__) + lib_dir = File.expand_path("../../lib", __dir__) base = { "MINITEST_TEST" => "#{self.class}##{minitest_test.label}", - "RUBYOPT" => "-I #{byebug_dir}" + "RUBYOPT" => "-I #{lib_dir}" } - base["RUBYOPT"] += " -r simplecov" if simplecov + if simplecov + test_dir = File.expand_path("..", __dir__) + base["RUBYOPT"] += " -r #{test_dir}/support/simplecov.rb" + end base end diff --git a/test/test_helper.rb b/test/test_helper.rb index eb068f66d..be32cef81 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "simplecov" if ENV["NOCOV"].nil? && Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6.a") +require "support/simplecov" require "support/test_case" Byebug::TestCase.before_suite