Skip to content

Commit

Permalink
Merge pull request #671 from deivid-rodriguez/avoid_simplecov_on_new_…
Browse files Browse the repository at this point in the history
…rubies

Avoid simplecov on new rubies
  • Loading branch information
deivid-rodriguez committed Apr 16, 2020
2 parents 7aaa05a + 9539053 commit a3da24e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions 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")
9 changes: 6 additions & 3 deletions test/support/utils.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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

0 comments on commit a3da24e

Please sign in to comment.