From 2a47ca63cf0c549ff5a595f065a05ad55ed6f6bf Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Fri, 10 Apr 2020 19:04:45 -0400 Subject: [PATCH] build: use nyc for coverage testing --- .gitignore | 1 + .travis.yml | 14 +++++++++----- package.json | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 97e8260..cd70de7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.nyc_output/ node_modules/ coverage/ npm-debug.log diff --git a/.travis.yml b/.travis.yml index 308f0ac..9c703c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -68,7 +74,7 @@ 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 @@ -76,7 +82,5 @@ script: after_script: - | # Upload coverage to coveralls - if [[ -f ./coverage/lcov.info ]]; then - npm install --save-dev coveralls@2.13.3 - coveralls < ./coverage/lcov.info - fi + npm install --save-dev coveralls@2 + nyc report --reporter=text-lcov | coveralls diff --git a/package.json b/package.json index 0494eaa..73e2d06 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } }