diff --git a/.gitignore b/.gitignore index 0fa6951..f15b98e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.nyc_output/ coverage/ node_modules/ npm-debug.log diff --git a/.travis.yml b/.travis.yml index fa1043c..a771aa4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,10 +64,6 @@ before_install: # Configure eslint for linting if node_version_lt '10.0'; then npm_remove_module_re '^eslint(-|$)' fi - - | - # Configure istanbul for coverage - if node_version_lt '0.10'; then npm_remove_module_re '^istanbul$' - fi - | # Configure mocha for testing if node_version_lt '0.10'; then npm_use_module 'mocha' '2.5.3' @@ -76,6 +72,13 @@ before_install: elif node_version_lt '8.0' ; then npm_use_module 'mocha' '6.2.2' elif node_version_lt '10.0'; then npm_use_module 'mocha' '7.2.0' fi + - | + # Configure nyc for coverage + if node_version_lt '0.10'; then npm_remove_module_re '^nyc$' + elif 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 - | # Configure supertest for http calls if node_version_lt '0.10'; then npm_use_module 'supertest' '1.1.0' @@ -90,9 +93,9 @@ before_install: npm rebuild fi script: - # Run test script, depending on istanbul install + # Run test script, depending on nyc install - | - if npm_module_installed 'istanbul'; then npm run-script test-travis + if npm_module_installed 'nyc'; then npm run-script test-ci else npm test fi # Run linting, depending on eslint install @@ -102,7 +105,7 @@ script: after_script: # Upload coverage to coveralls if exists - | - if [[ -f ./coverage/lcov.info ]]; then + if [[ -d .nyc_output ]]; then npm install --save-dev coveralls@2 - coveralls < ./coverage/lcov.info + nyc report --reporter=text-lcov | coveralls fi diff --git a/package.json b/package.json index d80bfc6..583c472 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "eslint": "7.26.0", "eslint-plugin-markdown": "2.1.0", "finalhandler": "1.1.2", - "istanbul": "0.4.5", "mocha": "8.4.0", + "nyc": "15.1.0", "safe-buffer": "5.2.1", "supertest": "6.1.3" }, @@ -40,8 +40,8 @@ "scripts": { "lint": "eslint .", "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=html --reporter=text npm test", + "test-cov": "nyc --reporter=text npm test", "version": "node scripts/version-history.js && git add HISTORY.md" } }