code coverage of new lines between 2 commits in ruby

1.1k Views Asked by At

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

1

There are 1 best solutions below

0
On

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