diff --git a/.gitignore b/.gitignore index 03b35ed..f60da07 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.swo node_modules npm-debug.log +test/.coverage diff --git a/.npmignore b/.npmignore index 364563b..5bd7128 100644 --- a/.npmignore +++ b/.npmignore @@ -3,3 +3,4 @@ example node_modules .gitignore .npmignore +test/.coverage diff --git a/README.md b/README.md index f57dd5b..90b682a 100644 --- a/README.md +++ b/README.md @@ -144,10 +144,26 @@ arguments that was passed to the final callback. `npm test` -or +Test scripts also support TAP when executed individually. You can use a tap consumer (such as [node-tap](https://github.com/isaacs/node-tap)) to consume +all tests: `tap test` -or +# test coverage -`jasmine-node test` +Test coverage reporting requires you to have [istanbul](https://github.com/gotwarlost/istanbul) installed. + +`npm install -g istanbul` + +Then you can run the coverage report: + +`npm run-script coverage` + +``` +=============================== Coverage summary =============================== +Statements : 100% ( 39/39 ) +Branches : 100% ( 8/8 ) +Functions : 100% ( 12/12 ) +Lines : 100% ( 39/39 ) +================================================================================ +``` diff --git a/package.json b/package.json index 4372323..1becf17 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ ], "main": "./index.js", "scripts": { - "test": "jasmine-node test; echo >&2 'Tests support TAP. Use node-tap and consume TAP output with \"tap test\".'" + "test": "jasmine-node test", + "coverage": "istanbul cover --print summary --dir ./test/.coverage jasmine-node -- test 2> /dev/null || echo 'Istanbul required for test coverage reports: npm install -g istanbul'" }, "engine": { "node": ">=0.8.8"