component-test icon indicating copy to clipboard operation
component-test copied to clipboard

code coverage?

Open stephenmathieson opened this issue 12 years ago • 7 comments

thoughts on implementing code coverage reporting using yields/coverage?

cli api could resemble:

$ component test {browser,phantom} --coverage

stephenmathieson avatar Dec 11 '13 13:12 stephenmathieson

Would be really awesome, also to integrate with node-coveralls Is mocha-phantomjs up for the task?

Swatinem avatar Dec 11 '13 16:12 Swatinem

@Swatinem idk if mocha-phantomjs will support it. setting that up on one my apps is on my todo list. if it's not, i plan on making it -- haha.

stephenmathieson avatar Dec 11 '13 16:12 stephenmathieson

It’s been ages since I worked with mocha-phantomjs myself. https://github.com/metaskills/mocha-phantomjs#jsoncov-reporter Well there is this. No idea if that can easily be integrated with https://github.com/StevenLooman/mocha-lcov-reporter, to be used by https://github.com/cainus/node-coveralls though.

Swatinem avatar Dec 11 '13 16:12 Swatinem

Code coverage would be awesome.

matthewmueller avatar Dec 11 '13 17:12 matthewmueller

+1

My current test harness uses CoverJS, but I would like to switch over to component-test because of how nicely it packages all these things together. :)

dominicbarnes avatar Jan 09 '14 16:01 dominicbarnes

So I have played with this a bit and come up with: https://github.com/Swatinem/component-istanbul This is just a small module that pipes files through istanbul for instrumentation. Then you can use the extremely ugly command line to get a report:

$ mkdir -p coverage && component test phantom -R node_modules/component-istanbul/reporter.js > coverage/coverage.json && istanbul report

Comments welcome :-)

(oh, and you need the latest PR to have an uptodate mocha-phantomjs)

Swatinem avatar Feb 25 '14 11:02 Swatinem

With my latest PR, you can just pass '--coverage coverage/coverage.json' and it will write to that file. I’m quite happy with that now.

Swatinem avatar Feb 26 '14 14:02 Swatinem