Skip to content

Commit f023828

Browse files
committed
build: use nyc for test coverage
1 parent 30c0871 commit f023828

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
.nyc_output
12
coverage
23
node_modules

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.nyc_output/
12
coverage/
23
node_modules/
34
npm-debug.log

.travis.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,20 @@ before_install:
6262
# Configure eslint for linting
6363
if node_version_lt '8.0'; then npm_remove_module_re '^eslint(-|$)'
6464
fi
65-
- |
66-
# Configure istanbul for coverage
67-
if node_version_lt '0.10'; then npm_remove_module_re '^istanbul$'
68-
fi
6965
- |
7066
# Configure mocha for testing
7167
if node_version_lt '0.10'; then npm_use_module 'mocha' '2.5.3'
7268
elif node_version_lt '4.0' ; then npm_use_module 'mocha' '3.5.3'
7369
elif node_version_lt '6.0' ; then npm_use_module 'mocha' '5.2.0'
7470
elif node_version_lt '8.0' ; then npm_use_module 'mocha' '6.2.2'
7571
fi
72+
- |
73+
# Configure nyc for coverage
74+
if node_version_lt '0.10'; then npm_remove_module_re '^nyc$'
75+
elif node_version_lt '4.0' ; then npm_use_module 'nyc' '10.3.2'
76+
elif node_version_lt '6.0' ; then npm_use_module 'nyc' '11.9.0'
77+
elif node_version_lt '8.0' ; then npm_use_module 'nyc' '14.1.1'
78+
fi
7679
- |
7780
# Configure supertest for http calls
7881
if node_version_lt '0.10'; then npm_use_module 'supertest' '1.1.0'
@@ -88,8 +91,8 @@ before_install:
8891
fi
8992
script:
9093
- |
91-
# Run test script, depending on istanbul install
92-
if npm_module_installed 'istanbul'; then npm run-script test-travis
94+
# Run test script, depending on nyc install
95+
if npm_module_installed 'nyc'; then npm run-script test-ci
9396
else npm test
9497
fi
9598
- |
@@ -99,7 +102,7 @@ script:
99102
after_script:
100103
- |
101104
# Upload coverage to coveralls
102-
if [[ -f ./coverage/lcov.info ]]; then
105+
if [[ -d .nyc_output ]]; then
103106
npm install --save-dev coveralls@2
104-
coveralls < ./coverage/lcov.info
107+
nyc report --reporter=text-lcov | coveralls
105108
fi

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"eslint-plugin-node": "9.2.0",
3030
"eslint-plugin-promise": "4.2.1",
3131
"eslint-plugin-standard": "4.0.1",
32-
"istanbul": "0.4.5",
3332
"mocha": "7.1.1",
33+
"nyc": "15.0.0",
3434
"split": "1.0.1",
3535
"supertest": "4.0.2"
3636
},
@@ -46,7 +46,7 @@
4646
"scripts": {
4747
"lint": "eslint --plugin markdown --ext js,md .",
4848
"test": "mocha --check-leaks --reporter spec --bail",
49-
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot",
50-
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec"
49+
"test-ci": "nyc --reporter=text npm test",
50+
"test-cov": "nyc --reporter=html --reporter=text npm test"
5151
}
5252
}

0 commit comments

Comments
 (0)