Simplecov: Exclude entire files from test coverage report

Created on 28 Jul 2015  路  2Comments  路  Source: simplecov-ruby/simplecov

My team uses SimpleCov with Code Climate and Travis CI. We have several entire files in our configurations folder that we'd like to skip from coverage reports. It'd be great if we could somehow configure this upfront in a .yml file, rather than using # :nocov: tags to surround each file!

Most helpful comment

I think you should be able to do this already using a filter.

SimpleCov.start do
  add_filter "path/to/your/file.rb"
end

Docs at https://github.com/colszowka/simplecov#defining-custom-filters (which suggest that this string is regex matched, so may need some anchors to make it specific enough)

Closing because I'm pretty sure that'll do it, but if not please do re-open!

All 2 comments

I think you should be able to do this already using a filter.

SimpleCov.start do
  add_filter "path/to/your/file.rb"
end

Docs at https://github.com/colszowka/simplecov#defining-custom-filters (which suggest that this string is regex matched, so may need some anchors to make it specific enough)

Closing because I'm pretty sure that'll do it, but if not please do re-open!

@xaviershay you're right, that works! Thanks for your help!

Was this page helpful?
0 / 5 - 0 ratings