Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ruby/private/coverage/rules_ruby_coverage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
SimpleCov.command_name ENV['BAZEL_TARGET'] if ENV['BAZEL_TARGET']

# SimpleCov 1.x deprecates add_filter in favor of skip, which 0.22 lacks.
skip_filter = SimpleCov.respond_to?(:skip) ? :skip : :add_filter

SimpleCov.start do
if RUBY_ENGINE == 'jruby'
# JRuby resolves files to their absolute realpaths (outside the sandbox).
Expand All @@ -30,13 +33,13 @@
root Dir.pwd
end

add_filter '/external/'
add_filter '/spec/'
add_filter '/test/'
SimpleCov.public_send(skip_filter, '/external/')
SimpleCov.public_send(skip_filter, '/spec/')
SimpleCov.public_send(skip_filter, '/test/')

if ENV['COVERAGE_FILTERS']
ENV['COVERAGE_FILTERS'].split(',').each do |filter|
add_filter filter.strip
SimpleCov.public_send(skip_filter, filter.strip)
end
end
end
Expand Down
Loading