Skip to content

Commit

Permalink
hack to fix simplecov when running minitest specs
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jan 23, 2024
1 parent 897abcc commit 8ef8818
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@
end
end

require "rubygems" unless defined? Gem

# Caused by https://github.com/simplecov-ruby/simplecov/pull/756 - simplecov plugin for minitest breaks
# code coverage when running minitest tests under rspec suite.
if Gem.loaded_specs.has_key?("minitest")
require "minitest"
module Minitest
def self.load_plugins
return unless extensions.empty?
seen = {}
Gem.find_files("minitest/*_plugin.rb").each do |plugin_path|
# here is the hack to fix minitest coverage
next if plugin_path.include?("simplecov")

name = File.basename plugin_path, "_plugin.rb"

next if seen[name]
seen[name] = true

require plugin_path
extensions << name
end
end
end
end

RSpec.configure do |config|
config.include ConfigurationHelpers
config.include TracerHelpers
Expand Down

0 comments on commit 8ef8818

Please sign in to comment.