Update CODEOWNERS
[puppet-modules/puppetlabs-apt.git] / spec / spec_helper_local.rb
1 # frozen_string_literal: true
2
3 if ENV['COVERAGE'] == 'yes'
4   require 'simplecov'
5   require 'simplecov-console'
6   require 'codecov'
7
8   SimpleCov.formatters = [
9     SimpleCov::Formatter::HTMLFormatter,
10     SimpleCov::Formatter::Console,
11     SimpleCov::Formatter::Codecov,
12   ]
13   SimpleCov.start do
14     track_files 'lib/**/*.rb'
15
16     add_filter '/spec'
17
18     # do not track vendored files
19     add_filter '/vendor'
20     add_filter '/.vendor'
21
22     # do not track gitignored files
23     # this adds about 4 seconds to the coverage check
24     # this could definitely be optimized
25     add_filter do |f|
26       # system returns true if exit status is 0, which with git-check-ignore means file is ignored
27       system("git check-ignore --quiet #{f.filename}")
28     end
29   end
30 end