How to ensure 100% coverage of git code is done with grunt-mocha-cov

I am trying to set up a continuous integration environment (using quick assembly) in which with every commit in the git branch I want to run our test package, check the code coverage and return the commit if either the test fails or the coverage code is below a certain threshold. In particular, I want to make sure that the code I'm checking is 100% verified. Our test suite was created using grunt and mocha-hack, and we use grunt-mocha-cov to cover. But grunt-mocha-cov uses all the source code. I want only git tools to be installed. Is there any way to do this?

+5
source share
1 answer

There is a tool called diff-cover that can check coverage for git diff. It takes XML coverage reports in Cobertura and compares with the output of git diff . It then reports the coverage information for the lines in diff.

I don’t see if grunt-mocha-cov can output Cobertura reports, but you should find some grunt plugin that does.

Note that diff-cover does not avoid unnecessary coverage tools for performance reasons.

0
source

Source: https://habr.com/ru/post/1200869/


All Articles