Comparing version 2.0.3 to 2.0.4
@@ -9,3 +9,3 @@ var TRAVIS_JOB_ID = process.env.TRAVIS_JOB_ID || 'unknown'; | ||
details.forEach(function(obj){ | ||
coverage[obj.line] = obj.hit; | ||
coverage[obj.line - 1] = obj.hit; | ||
}); | ||
@@ -12,0 +12,0 @@ return coverage; |
@@ -5,3 +5,3 @@ { | ||
"keywords" : ["coverage", "coveralls"], | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"bugs": { | ||
@@ -8,0 +8,0 @@ "url": "https://github.com/cainus/node-coveralls/issues" |
#node-coveralls | ||
[![Build Status](https://travis-ci.org/cainus/node-coveralls.png?branch=master)](https://travis-ci.org/cainus/node-coveralls) | ||
@@ -7,9 +8,9 @@ [Coveralls.io](https://coveralls.io/) support for node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button ( like this: ![](https://s3.amazonaws.com/assets.coveralls.io/badges/coveralls_94.png) ) to your README. | ||
This script ( `bin/coveralls.js` ) can take standard input in the JSON format from [mocha](http://visionmedia.github.com/mocha/)'s JSONCov reporter and send it to coveralls.io to report your code coverage there. It needs to run from [travis-ci](http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/) to work. | ||
This script ( `bin/coveralls.js` ) can take standard input from any tool that emits the lcov data format (including [mocha](http://visionmedia.github.com/mocha/)'s [LCov reporter](https://npmjs.org/package/mocha-lcov-reporter)) and send it to coveralls.io to report your code coverage there. It needs to run from [travis-ci](http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/) to work. | ||
Instrumenting your app for coverage is probably harder than it needs to be (read [here](http://www.seejohncode.com/2012/03/13/setting-up-mocha-jscoverage/) or [here](http://tjholowaychuk.com/post/18175682663/mocha-test-coverage)), but that's also a necessary step. | ||
Once your app is instrumented for coverage, and building in travis-ci, you just need to set your mocha reporter to the JSONCov reporter, and pipe the output to `./node_modules/coveralls/bin/coveralls.js`. | ||
Once your app is instrumented for coverage, and building in travis-ci, you just need to pipe the lcov output to `./node_modules/coveralls/bin/coveralls.js`. | ||
Check out an example [Makefile](https://github.com/cainus/Prozess/blob/master/Makefile) from one of my projects for an example, especially the test-coveralls build target. Note: Travis runs `npm test`, so whatever target you create in your Makefile must be the target that `npm test` runs. Also note that the TRAVIS_JOB_ID is necessary. | ||
Check out an example [Makefile](https://github.com/cainus/urlgrey/blob/master/Makefile) from one of my projects for an example, especially the test-coveralls build target. Note: Travis runs `npm test`, so whatever target you create in your Makefile must be the target that `npm test` runs. Also note that the TRAVIS_JOB_ID is necessary. | ||
@@ -14,4 +14,4 @@ var convertLcovToCoveralls = require('../lib/convertLcovToCoveralls'); | ||
output.source_files[0].source.split("\n").length.should.equal(225); | ||
output.source_files[0].coverage[55].should.equal(0); | ||
output.source_files[0].coverage[61].should.equal(0); | ||
output.source_files[0].coverage[54].should.equal(0); | ||
output.source_files[0].coverage[60].should.equal(0); | ||
}); | ||
@@ -18,0 +18,0 @@ |
172370
16