filter coverage result with vendored libraries and test code

This commit is contained in:
Hiroshi SHIBATA 2023-01-26 10:50:08 +09:00
parent eb2670e32d
commit 98e84f3f7a
Notes: git 2023-01-26 04:52:42 +00:00

View File

@ -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