Skip to content

Commit

Permalink
build: use nyc for coverage testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Apr 10, 2020
1 parent 97df811 commit 2a47ca6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.nyc_output/
node_modules/
coverage/
npm-debug.log
Expand Down
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ before_install:
elif node_version_lt '6.0'; then npm_use_module 'mocha' '5.2.0'
elif node_version_lt '8.0'; then npm_use_module 'mocha' '6.2.2'
fi
- |
# Configure nyc for testing
if node_version_lt '4.0'; then npm_use_module 'nyc' '10.3.2'
elif node_version_lt '6.0'; then npm_use_module 'nyc' '11.9.0'
elif node_version_lt '8.0'; then npm_use_module 'nyc' '14.1.1'
fi
# Update Node.js modules
- |
# Prune & rebuild node_modules
Expand All @@ -68,15 +74,13 @@ before_install:
script:
- |
# Run test script
npm run-script test-travis
npm run-script test-ci
- |
# Run linting, depending on eslint install
if npm_module_installed 'eslint'; then npm run-script lint
fi
after_script:
- |
# Upload coverage to coveralls
if [[ -f ./coverage/lcov.info ]]; then
npm install --save-dev [email protected]
coveralls < ./coverage/lcov.info
fi
npm install --save-dev coveralls@2
nyc report --reporter=text-lcov | coveralls
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"devDependencies": {
"eslint": "6.8.0",
"eslint-plugin-markdown": "1.0.2",
"istanbul": "0.4.5",
"mkdirp": "0.5.4",
"mocha": "7.1.1",
"nyc": "15.0.1",
"pend": "1.2.0",
"require-all": "3.0.0",
"rimraf": "2.6.3",
Expand All @@ -45,7 +45,7 @@
"scripts": {
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
"test-ci": "nyc --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
}

0 comments on commit 2a47ca6

Please sign in to comment.