1
votes

I namespace my Rails 6 app into three parts and I want to run the code coverage only for a specific namespace like

$ rails test test/controllers/office
$ rails test test/controllers/member
$ rails test test/controllers/provider

SimpleCov currently shows the coverage of the whole project. I want to see the coverage report only for the specified tests.

I do not find any (direct) documentation. Closest thing is simplecov's profile but it

  • needs profile name (hard-coded or env variable)
  • accepts only one profile
  • requires configured profiles
  • does not relate with specified tests

How can I achieve code coverage report ONLY for the specified tests?

  • Is there any existing way with simplecov?
  • Is there any other alternative to simplecov to achieve what I want?

UPDATE:

simplecov has these directly related but open issues

UPDATE 2:

simplecov currently

I could use add_filter to exclude all the files not in the running testsTun