Enable code coverage tracking

This commit is contained in:
David Schmitt 2018-01-26 14:05:22 +00:00
parent 2d4bafbb18
commit 8364b8e685
5 changed files with 28 additions and 4 deletions

3
.gitignore vendored
View File

@ -38,3 +38,6 @@ Gemfile.lock
/log/ /log/
/*.gem /*.gem
/spec/acceptance/nodesets/ /spec/acceptance/nodesets/
## local coverage results
/coverage/

View File

@ -27,4 +27,4 @@ matrix:
- rvm: 2.1.9 - rvm: 2.1.9
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
script: 'SPEC_OPTS="--format documentation" bundle exec rake $CHECK' script: 'SPEC_OPTS="--format documentation" COVERAGE="yes" bundle exec rake $CHECK'

View File

@ -13,10 +13,12 @@ else
end end
group :test do group :test do
gem "rspec", "~> 3.1" gem 'codecov'
gem 'mocha' gem 'mocha'
gem 'puppetlabs_spec_helper' gem 'puppetlabs_spec_helper'
gem 'serverspec' gem 'serverspec'
gem 'simplecov-console'
gem "rspec", "~> 3.1"
end end
group :acceptance do group :acceptance do

3
codecov.yml Normal file
View File

@ -0,0 +1,3 @@
---
# disable comments, info can be gotten from the pr status updates, and the comment editing spams the hipchat notifications
comment: false

View File

@ -1,3 +1,20 @@
if ENV['COVERAGE'] == 'yes'
require 'simplecov'
require 'simplecov-console'
require 'codecov'
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console,
SimpleCov::Formatter::Codecov,
]
SimpleCov.start do
track_files 'lib/**/*.rb'
add_filter '/spec'
end
end
require 'mocha' require 'mocha'
require 'rspec' require 'rspec'
require 'puppet/version' require 'puppet/version'
@ -21,4 +38,3 @@ RSpec.configure do |config|
YARD::Registry.clear YARD::Registry.clear
end end
end end