Trace only class under test with rcov

42 views Asked by At

I want to start rcov for a single test but the execution took several seconds/minutes since rcov seems to load the complete applications and starts to trace all source files. I'm only interested in the rcov report for the class under test. To improve the feedback time I want to exlcude all other files.

# run rcov/test for MyClass (my_class.rb)
rcov --text-coverage my_class_test.rb

The commandline offers me the --exclude/--exclude-only but I couldn't find a proper solution for my question.

How can I exlude all classes/files except my class under test (e.g. my_class.rb)?

1

There are 1 answers

0
sschmeck On BEST ANSWER

After reading the source code I found a solution.

rcov --include-file my_class.rb --exclude-only .+ my_class_test.rb

But rcov does collect all classes of the project before running the test. Maybe there is room for improvement.