aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Shaw <[email protected]>2013-07-05 08:58:13 +0100
committerAlan Shaw <[email protected]>2013-07-05 08:58:13 +0100
commitcf69973030984890157193efd603f21b5d4e568c (patch)
tree6c55ce46fa066b4a55c99f8c6dc49d53e21b0938
parent7f43f5d8cc39cb47687ecdba7034baf9eac46ba4 (diff)
downloadnode-coveralls-cf69973030984890157193efd603f21b5d4e568c.tar.xz
node-coveralls-cf69973030984890157193efd603f21b5d4e568c.zip
Docs for using with nodeunit and jscoverage
-rw-r--r--README.md33
1 files changed, 30 insertions, 3 deletions
diff --git a/README.md b/README.md
index 3ccd94a..bdc88b7 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ There are optional environment variables for other build systems as well:
* COVERALLS_RUN_AT (a date string for the time that the job ran. RFC 3339 dates work. This defaults to your
build system's date/time if you don't set it.)
-###[Blanket.js](https://github.com/alex-seville/blanket)
+### [Mocha](http://visionmedia.github.io/mocha/) + [Blanket.js](https://github.com/alex-seville/blanket)
- Install [blanket.js](http://blanketjs.org/)
- Configure blanket according to [docs](https://github.com/alex-seville/blanket/blob/master/docs/getting_started_node.md).
- Run your tests with a command like this:
@@ -41,12 +41,12 @@ NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha \
--require blanket \
--reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
```
-###[JSCoverage](https://github.com/fishbar/jscoverage)
+### [Mocha](http://visionmedia.github.io/mocha/) + [JSCoverage](https://github.com/fishbar/jscoverage)
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.
In mocha, if you've got your code instrumented for coverage, the command for a travis build would look something like this:
-```console
+```sh
YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
```
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 (This is set in package.json's 'scripts' property).
@@ -54,6 +54,33 @@ Check out an example [Makefile](https://github.com/cainus/urlgrey/blob/master/Ma
##[Istanbul](https://github.com/gotwarlost/istanbul)
TODO
+## [Nodeunit](https://github.com/caolan/nodeunit) + [JSCoverage](https://github.com/fishbar/jscoverage)
+
+Depend on nodeunit, jscoverage and coveralls:
+
+```sh
+npm install nodeunit jscoverage coveralls --save-dev
+```
+
+Add a coveralls script to "scripts" in your `package.json`:
+
+```javascript
+"scripts": {
+ "test": "nodeunit test",
+ "coveralls": "jscoverage lib && YOURPACKAGE_COVERAGE=1 nodeunit --reporter=lcov test | coveralls"
+}
+```
+
+Ensure your app requires instrumented code when `process.env.YOURPACKAGE_COVERAGE` variable is defined.
+
+Run your tests with a command like this:
+
+```sh
+npm run coveralls
+```
+
+For detailed instructions on requiring instrumented code, running on Travis and submitting to coveralls [see this guide](https://github.com/alanshaw/nodeunit-lcov-coveralls-example).
+
## Running locally
If you're running locally, you must have a `.coveralls.yml` file, as documented in [their documentation](https://coveralls.io/docs/ruby), with your `repo_token` in it; or, you must provide a `COVERALLS_REPO_TOKEN` environment-variable on the command-line.