Code coverage for meteor app?


#1

Hi guys,

I’m currently looking for a way to have a code coverage report and use it process in a CI context. The current setup is an Mocha + chimp + phantomjs test suite covering client/server and imports.

I did some experiment with Karma-coverage and Meteor-coverage, but those doesn’t have the needed flexibility or the accuracy.

Does some of you have this kind of setup in place?
Thanks


#2

You may find this thread helpful:


#3

There are no coverage support for chimp right now, but you can try to get your mocha coverage !

Good luck.

I did some experiment with Karma-coverage and Meteor-coverage

Which Meteor-coverage ?


#4

I tried your project. There a lot of good things in it, so might contribute a bit to integrate the changes that i need.

Merci


#5

De rien - You welcome.

What are you looking for ? - Que comptes tu faire ?

Since Chimp tests your app using the production build, this is strictly incompatible with the debugOnly flag of meteor-coverage package


#6

Actually, i want to include the code coverage check into Snap-ci pipeline.

I want to have at least mocha unit test coverage + a threshold that would fail the build if the coverage is under it.
I was thinking about a matching exit status or a coverage report that i could parse.


#7

I think if you implement the json-summary type of Meteor.exportCoverage (from my package) you will get in a file the global coverage. By reading the code from istanbul-report ( https://github.com/istanbuljs/istanbul-reports/blob/master/lib/json-summary/index.js ) you can expect something like {'total': 12.34}

Another script or spacejam would be able to read that file, parse it and raise an error if it’s not good enough.


#8

The text-summary export have been implemented on the last version, you should check that.

It looks like that:

============Coverage summary====================
Statements : 67.73% ( 550/812 )
Branches : 48.06% ( 149/310 )
Functions : 63.95% ( 94/147 )
Lines : 67.56% ( 527/780 )