Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code coverage of new lines between 2 commits in ruby

I would like to ensure that all new lines written added are covered by test. Is there a simple way to do an intersection between git diff and simplecov coverage.

http://fredwu.me/post/35625566267/simplecov-test-coverage-for-changed-files-only something like this but with lines granularity instead of files

like image 366
trax Avatar asked Oct 20 '22 21:10

trax


1 Answers

For git diffs, there is a tool named diff-cover, which can check coverage. It takes Cobertura XML coverage reports and compares with the output of git diff. It then reports coverage information for lines in the diff.

With an xml file produced by simplecov-cobertura, you can use this command to check the coverage of your changes compared to the master branch:

$ diff-cover coverage.xml
like image 79
Dag Høidahl Avatar answered Oct 24 '22 10:10

Dag Høidahl