Skip to content

Commit

Permalink
build: use nyc for test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Nov 16, 2018
1 parent bbb90b6 commit 3bc817a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.nyc_output
coverage
node_modules
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.nyc_output/
coverage/
node_modules/
npm-debug.log
Expand Down
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ before_install:
# Skip updating shrinkwrap / lock
- "npm config set shrinkwrap false"
# Setup Node.js version-specific dependencies
- test $TRAVIS_NODE_VERSION != '0.6' || npm rm --save-dev istanbul
- test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul
- "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 6 || npm rm --save-dev nyc"
- "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 6 || npm rm --save-dev $(grep -E '\"eslint\\S*\"' package.json | cut -d'\"' -f2)"
# 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"
- "test -z $(npm -ps ls eslint ) || npm run-script lint"
# Run test script, depending on nyc install
- "test ! -z $(npm -ps ls nyc) || npm test"
- "test -z $(npm -ps ls nyc) || npm run-script test-cov"
- "test -z $(npm -ps ls eslint) || npm run-script lint"
after_script:
- "test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
- "test -d .nyc_output && npm install coveralls@2 && nyc report --reporter=text-lcov | coveralls"
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"eslint-plugin-node": "7.0.1",
"eslint-plugin-promise": "4.0.1",
"eslint-plugin-standard": "4.0.0",
"istanbul": "0.4.5",
"mocha": "1.21.5"
"mocha": "1.21.5",
"nyc": "13.1.0"
},
"files": [
"HISTORY.md",
Expand All @@ -32,8 +32,7 @@
],
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
"test": "mocha test/",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
}

0 comments on commit 3bc817a

Please sign in to comment.