Skip to content

Commit

Permalink
test: restore simplecov (#3292)
Browse files Browse the repository at this point in the history
**What problem is this PR intended to solve?**

Simplecov was broken by #3280, but see
simplecov-ruby/simplecov#1032 for discussion
that led to this workaround.
  • Loading branch information
flavorjones committed Jul 15, 2024
2 parents 2d0afb8 + e4d20c0 commit 80d6806
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions rakelib/test.rake
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ end
def nokogiri_test_task_configuration(t)
t.libs << "test"
t.verbose = true if ENV["TESTGLOB"]
t.test_prelude = 'require "simplecov_prelude"' if t.respond_to?(:test_prelude)
end

def nokogiri_test_case_configuration(t)
Expand Down
8 changes: 0 additions & 8 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
# - NOKOGIRI_MEMORY_SUITE: read more in test/test_memory_usage.rb
#

unless ENV["RUBY_MEMCHECK_RUNNING"] || ENV["NCPU"]
require "simplecov"
SimpleCov.start do
add_filter "/test/"
enable_coverage :branch
end
end

$VERBOSE = true

require "fileutils"
Expand Down
10 changes: 10 additions & 0 deletions test/simplecov_prelude.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

# https://github.com/simplecov-ruby/simplecov/issues/1032
unless ENV["RUBY_MEMCHECK_RUNNING"] || ENV["NCPU"].to_i > 1
require "simplecov"
SimpleCov.start do
add_filter "/test/"
enable_coverage :branch
end
end

0 comments on commit 80d6806

Please sign in to comment.