From e6f490223ce640635b738d0155c0f5a5c9fa188d Mon Sep 17 00:00:00 2001 From: "Reser, Ben" Date: Fri, 11 Aug 2017 20:32:45 -0700 Subject: [PATCH] Re-enable test coverage reporting Fixed the cov command just like I'd done for the test command, so that it will properly exit with an non-zero exit code on test failure. Switched back to using the cov script for doing the tests. --- .travis.yml | 2 +- package.json | 2 +- test/test.sh | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93fa054..e78b58e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_script: - git config --global user.email "ryan@ryanbreen.com" - git config --global user.name "Ryan Breen" script: -- npm run test +- npm run cov deploy: provider: npm email: ryan@ryanbreen.com diff --git a/package.json b/package.json index 81b4b85..92cf021 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "bin": "./index.js", "scripts": { "test": "./test/test.sh", - "cov": "`npm bin`/istanbul cover --root . -x node_modules -x test --dir ./reports `npm bin`/_mocha -- --reporter spec -t 10000 test | bunyan", + "cov": "./test/test.sh cov", "coveralls": "npm run cov && node_modules/coveralls/bin/coveralls.js < reports/lcov.info" }, "licenses": [ diff --git a/test/test.sh b/test/test.sh index 9b845f7..d0bdc6e 100755 --- a/test/test.sh +++ b/test/test.sh @@ -2,4 +2,12 @@ set -o pipefail -./node_modules/.bin/_mocha --reporter spec -t 10000 test | bunyan +bin=$(npm bin) +mocha_args='--reporter spec -t 10000 test' + +if [ "$1" == "cov" ]; then + "$bin/istanbul" cover --root . -x node_modules -x test --dir ./reports \ + "$bin/_mocha" -- $mocha_args | bunyan +else + "$bin/_mocha" $mocha_args | bunyan +fi