Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support File Output of Coverage Results #14

Open
billmag opened this issue Jan 30, 2014 · 9 comments
Open

Support File Output of Coverage Results #14

billmag opened this issue Jan 30, 2014 · 9 comments

Comments

@billmag
Copy link

billmag commented Jan 30, 2014

As a next step to incorporating grunt-blanket-mocha into my build, I'd like to be able to easily output the coverage results into a file in a format that's somehow digestible by Jenkins. There are a number of options out there and I'm personally not very informed on the landscape of reporting options, but this would be pretty fantastic functionality to add.

@geekdave
Copy link
Contributor

I've got something rudimentary working that outputs one file per-module. For instance if you had the modules "user" and "product", you would get user.json and product.json.

The output looks like this:

{
  "moduleName": "uifw",
  "msg": "PASS [ 59% = 59% ] : uifw (648 \/ 1083)",
  "threshold": 59,
  "numCovered": 648,
  "numTotal": 1083,
  "operator": "=",
  "result": "PASS",
  "percentCovered": 59,
  "pass": true,
  "ok": true,
  "total": 117,
  "passes": 117,
  "failures": 0,
  "pending": 0,
  "duration": "1.64"
}

So if you output to a known coverage output directory, you could iterate over these files, parse them as JSON (perhaps another grunt plugin to do this) and do whatever you want with the data. Would that work?

Still need to clean this up and de-spaghettify it before it's ready to push.

@billmag
Copy link
Author

billmag commented Jan 30, 2014

Doing a bit of poking around on the net, it appears that lcov or cobertura
compatible output would be best.

JSCover apparently supports both:
http://tntim96.github.io/JSCover/

Here's an example of the cobertura XML spec:
https://raw.github.com/jenkinsci/cobertura-plugin/master/src/test/resources/hudson/plugins/cobertura/coverage-with-data.xml

Here's some converters from lcov and jscover default output:
https://github.com/NumberFour/jscoverage-cobertura-maven-plugin
http://eriwen.github.io/lcov-to-cobertura-xml/

There's also this lcov reporter for mocha which might be of interest?
https://npmjs.org/package/mocha-lcov-reporter

On Thu, Jan 30, 2014 at 1:48 PM, Dave Cadwallader
[email protected]:

I've got something rudimentary working that outputs one file per-module.
For instance if you had the modules "user" and "product", you would get
user.json and product.json.

The output looks like this:

{
"moduleName": "uifw",
"msg": "PASS [ 59% = 59% ] : uifw (648 / 1083)",
"threshold": 59,
"numCovered": 648,
"numTotal": 1083,
"operator": "=",
"result": "PASS",
"percentCovered": 59,
"pass": true,
"ok": true,
"total": 117,
"passes": 117,
"failures": 0,
"pending": 0,
"duration": "1.64"}

So if you output to a known coverage output directory, you could iterate
over these files, parse them as JSON (perhaps another grunt plugin to do
this) and do whatever you want with the data. Would that work?

Still need to clean this up and de-spaghettify it before it's ready to
push.

Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-33737626
.

Bill Magnuson* @billmag* :: Co-Founder & CTO ::
appboy.comhttp://www.appboy.com/

@geekdave
Copy link
Contributor

Awesome... thanks, @billmag. Will take a look at these.

@simonoff
Copy link

simonoff commented Feb 2, 2014

Yes. Would be nice to have lcov reporter to send coverage to coveralls

@shortstuffsushi
Copy link

I'd love to see this implemented as well. Currently, we're parsing the output text to find coverage numbers for historic data. It would be nice if there was a way to just read it from a pre-formatted file instead.

@jamesplease
Copy link

👍

@SquadraCorse
Copy link

Your help on generating lcov is highly appreciated.

@geekdave
Copy link
Contributor

I'm looking for volunteers to help with this feature. It's unlikely that I'll have time to work on it anytime soon.

@andrewhood125
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants