Permalink
Browse files

build: test coverage with istanbul

  • Loading branch information...
1 parent ac77c24 commit 69ca9b761dae0c8ec4d2f9e34d2b0bb1aeebdbe8 @dougwilson dougwilson committed Aug 12, 2016
Showing with 16 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +8 −0 .travis.yml
  3. +3 −0 README.md
  4. +4 −1 package.json
View
@@ -1 +1,2 @@
+coverage/
node_modules
View
@@ -14,6 +14,14 @@ cache:
directories:
- node_modules
before_install:
+ # Setup Node.js version-specific dependencies
+ - "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
# Update Node.js modules
- "test ! -d node_modules || npm prune"
- "test ! -d node_modules || npm rebuild"
+script:
+ # Run test script, depending on istanbul install
+ - "test ! -z $(npm -ps ls istanbul) || npm test"
+ - "test -z $(npm -ps ls istanbul) || npm run-script test-ci"
+after_script:
+ - "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
View
@@ -5,6 +5,7 @@ Cookies
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
Cookies is a [node.js](http://nodejs.org/) module for getting and setting HTTP(S) cookies. Cookies can be signed to prevent tampering, using [Keygrip](https://www.npmjs.com/package/keygrip). It can be used with the built-in node.js HTTP library, or as Connect/Express middleware.
@@ -127,6 +128,8 @@ Send any questions or comments [here](http://twitter.com/jedschmidt).
[npm-image]: https://img.shields.io/npm/v/cookies.svg
[npm-url]: https://npmjs.org/package/cookies
+[coveralls-image]: https://img.shields.io/coveralls/pillarjs/cookies/master.svg
+[coveralls-url]: https://coveralls.io/r/pillarjs/cookies?branch=master
[downloads-image]: https://img.shields.io/npm/dm/cookies.svg
[downloads-url]: https://npmjs.org/package/cookies
[node-version-image]: https://img.shields.io/node/v/cookies.svg
View
@@ -9,6 +9,7 @@
},
"devDependencies": {
"express": "4.7.4",
+ "istanbul": "0.4.4",
"mocha": "1.21.5",
"restify": "2.8.1",
"supertest": "1.1.0"
@@ -26,6 +27,8 @@
"node": ">= 0.8"
},
"scripts": {
- "test": "mocha --require test/support/env --reporter spec"
+ "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/",
+ "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/",
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/"
}
}

0 comments on commit 69ca9b7

Please sign in to comment.