When using a super simple simplecov
setup like
require 'simplecov'
SimpleCov.start
I get loads of "coverage" for files and code that were not really "executed" (in any sense that I would care about when looking at code coverage for a specific test) at all with the individual test I was running.
For example all the require
, module
, class
, def
, attr_accessor
etc. are marked in green for all files that were loaded on the coverage report generated. I do not care about those, and would be happy if those files would report 0% coverage if no "actual code" was executed in them.
end
, rescue
and comments for example are considered not relevant and not marked red or green in any files. I would like similar behavior for the methods listed above.
Is there a way to get a code coverage that really only includes (and measures) the actual code lines being executed that I care about?
Update after first answer:
Marking all other code as "not relevant" via e.g. # :nocov:
is unfortunately not an option as this would affect thousands of files for each individual test run.