node-cover icon indicating copy to clipboard operation
node-cover copied to clipboard

using cover as a library

Open defunctzombie opened this issue 13 years ago • 4 comments

Is there a good example (or even possible) to use cover as a library? The thinking would be to instrument it into a test suite (like mocha) so that the testing and coverage generation can happen all at once just by running the main test framework.

From my very limited understanding of cover, it works by intercepting require, which I think should mean that it could be dropped in to a nodejs app as a library?

defunctzombie avatar Aug 31 '12 17:08 defunctzombie

@itay are you still working on this project? Any thoughts on the above?

defunctzombie avatar Nov 24 '12 16:11 defunctzombie

I would be also interested in the above.

Adding a unit test that checks the cover stats and confirms that all files are above a certain level of code coverage should be a simple thing to do. (similarly to what you do in the cli reporter to decide the red color of the row)

(I was thinking of adding a test like that ... it would fire when travis-ci kicks in... and make sure that no commit brings down the code coverage. So neat! )

ogt avatar Apr 24 '13 21:04 ogt

@ogt @shtylman I haven't had time, but I would more than welcome someone doing this. Happy to give either of you push access to the repo, and give some guidance on where to put things.

itay avatar Apr 24 '13 22:04 itay

Thank you @itay. No need for push access. Let me look a bit at the code to see how easy/hard it is. I am using jshint as a model of how this should work from the caller's perspective.

ogt avatar Apr 25 '13 18:04 ogt