grunt-mocha icon indicating copy to clipboard operation
grunt-mocha copied to clipboard

code coverage

Open j opened this issue 12 years ago • 4 comments

Is there a way to tie in code coverage?

Also, I'd like to tie both into jenkins and be able to fail builds if tests fail or if certain amount of lines aren't covered... Any ideas on the best way to do this?

j avatar Feb 08 '13 00:02 j

Currently, no. I am planning on looking into integrating https://github.com/metaskills/mocha-phantomjs instead of our current phantom -> console system, theoretically it would support CI integration.

kmiyashiro avatar Feb 13 '13 05:02 kmiyashiro

For anyone who's interested, I forked this project to add "live" code-coverage enforcement via BlanketJS: https://github.com/ModelN/grunt-blanket-mocha

Note that this differs from other implementations (such as ones that use Istanbul) which create physical instrumented copies of your source files to check coverage. Blanket does it in-memory.

This also allows you to fail the build if a certain minimum coverage threshold is not met. I'm currently using this with TravisCI as shown in one of my projects here: https://travis-ci.org/ModelN/backbone.geppetto/builds/9711973

This also integrates nicely with Jenkins as we're doing on an internal project at my company.

geekdave avatar Jul 31 '13 21:07 geekdave

Is there any movement on this? Is it possible to integrate @geekdave's changes into grunt-mocha proper?

dpehrson avatar Nov 01 '13 22:11 dpehrson

At this point it's probably better to leave our projects as separate, since they have different goals. I've used my fork on a few projects now, and I've been adding new features frequently, so frankly I'd prefer to stay in control. :)

I wrote a blog about it here, if you're interested in learning more: http://www.geekdave.com/2013/08/02/automated-code-coverage-enforcement-for-mocha-using-grunt-and-blanket/

geekdave avatar Nov 01 '13 22:11 geekdave