summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-01-26 10:50:08 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-01-26 13:52:20 +0900
commit98e84f3f7a1fa69530c67ab9bc63271b812718ea (patch)
tree5e836ac25e2a68adc8f9f104854010809962ee2a /tool
parenteb2670e32df1bfd63167748f81f480a0dc4f0f72 (diff)
filter coverage result with vendored libraries and test code
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7185
Diffstat (limited to 'tool')
-rw-r--r--tool/test-coverage.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/tool/test-coverage.rb b/tool/test-coverage.rb
index 8913d8d435..bb181fa106 100644
--- a/tool/test-coverage.rb
+++ b/tool/test-coverage.rb
@@ -4,6 +4,12 @@ Coverage.start(lines: true, branches: true, methods: true)
TEST_COVERAGE_DATA_FILE = "test-coverage.dat"
+FILTER_PATHS = %w[
+ tool/lib
+ lib/bundler/vendor
+ test
+]
+
def merge_coverage_data(res1, res2)
res1.each do |path, cov1|
cov2 = res2[path]
@@ -77,7 +83,7 @@ def invoke_simplecov_formatter
res.each do |path, cov|
next unless path.start_with?(base_dir) || path.start_with?(cur_dir)
- next if path.start_with?(File.join(base_dir, "test"))
+ next if FILTER_PATHS.any? {|dir| path.start_with?(File.join(base_dir, dir))}
simplecov_result[path] = cov
end