Skip to content

Commit 26dac12

Browse files
hsbtclaude
andcommitted
Disable coverage collection in ruby/ruby repository
Skip SimpleCov setup when running inside the ruby/ruby repository to avoid interference. Detection uses GEM_COMMAND env var for rubygems and bundler.gemspec presence for bundler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c9a6623 commit 26dac12

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Rakefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ Rake::TestTask.new do |t|
6868
t.ruby_opts = %w[-w]
6969
t.ruby_opts << "-rdevkit" if RbConfig::CONFIG["host_os"].include?("mingw")
7070

71-
coverage_setup = File.expand_path("test/rubygems/coverage_setup.rb", __dir__)
72-
t.ruby_opts.unshift("--disable-gems", "-r#{coverage_setup}")
71+
unless ENV["GEM_COMMAND"]
72+
coverage_setup = File.expand_path("test/rubygems/coverage_setup.rb", __dir__)
73+
t.ruby_opts.unshift("--disable-gems", "-r#{coverage_setup}")
74+
end
7375

7476
t.libs << "test"
7577
t.test_files = FileList["test/**/test_*.rb"]

bundler/spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
require_relative "support/windows_tag_group"
4242

4343
begin
44+
raise LoadError if File.exist?(File.expand_path("../../../lib/bundler/bundler.gemspec", __dir__))
45+
4446
gem "simplecov_json_formatter"
4547
require "simplecov"
4648

test/rubygems/helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
require "test/unit"
1111

1212
begin
13+
raise LoadError if ENV["GEM_COMMAND"]
14+
1315
gem "simplecov_json_formatter"
1416
require "simplecov"
1517

0 commit comments

Comments
 (0)