Coverage Docs callout for filtering to mirror local results
Problem
There are times when I run my coverage job locally and on gitlab.com and get different results. There is a known workaround to resolve this (make sure you're filtering the same items) but that isn't documented in GitLab docs.
Proposal
Update the locations below to include a tip about how to make coverage match locally / on gitlab.com
- https://docs.gitlab.com/ee/ci/yaml/#coverage
- https://docs.gitlab.com/ee/user/project/pipelines/settings.html#test-coverage-parsing
Finished in 0.72853 seconds (files took 1.65 seconds to load) 28 examples, 0 failures Coverage report generated for RSpec to /home/user/projects/app/coverage. 222 / 225 LOC (98.67%) covered. but on Gitlab I get this result 48%: Finished in 1.03 seconds (files took 6.18 seconds to load) 28 examples, 0 failures Coverage report generated for RSpec to /builds/username/app/coverage. 51991 / 106919 LOC (48.63%) covered. Where is the difference from? My .gitlab-ci.yml:
image: "ruby:2.5.1"
cache:
paths:
- vendor/ruby
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- ruby -v
- which ruby
- gem install bundler --no-ri --no-rdoc
- bundle install --jobs $(nproc) --path vendor
rspec:
script:
- bundle exec rspec