Skip to content

Commit 12310c5

Browse files
committed
build: use nyc for test coverage
1 parent 884657d commit 12310c5

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,39 @@ jobs:
3131
include:
3232
- name: Node.js 0.10
3333
node-version: "0.10"
34-
npm-i: minimatch@3.0.4 mocha@3.5.3 supertest@2.0.0
34+
npm-i: minimatch@3.0.4 mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
3535

3636
- name: Node.js 0.12
3737
node-version: "0.12"
38-
npm-i: minimatch@3.0.4 mocha@3.5.3 supertest@2.0.0
38+
npm-i: minimatch@3.0.4 mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
3939

4040
- name: io.js 1.x
4141
node-version: "1.8"
42-
npm-i: minimatch@3.0.4 mocha@3.5.3 supertest@2.0.0
42+
npm-i: minimatch@3.0.4 mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
4343

4444
- name: io.js 2.x
4545
node-version: "2.5"
46-
npm-i: minimatch@3.0.4 mocha@3.5.3 supertest@2.0.0
46+
npm-i: minimatch@3.0.4 mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
4747

4848
- name: io.js 3.x
4949
node-version: "3.3"
50-
npm-i: minimatch@3.0.4 mocha@3.5.3 supertest@2.0.0
50+
npm-i: minimatch@3.0.4 mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
5151

5252
- name: Node.js 4.x
5353
node-version: "4.9"
54-
npm-i: mocha@5.2.0 supertest@3.4.2
54+
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
5555

5656
- name: Node.js 5.x
5757
node-version: "5.12"
58-
npm-i: mocha@5.2.0 supertest@3.4.2
58+
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
5959

6060
- name: Node.js 6.x
6161
node-version: "6.17"
62-
npm-i: mocha@6.2.2 supertest@6.1.6
62+
npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6
6363

6464
- name: Node.js 7.x
6565
node-version: "7.10"
66-
npm-i: mocha@6.2.2 supertest@6.1.6
66+
npm-i: mocha@6.2.2 nyc@14.1.1 supertest@6.1.6
6767

6868
- name: Node.js 8.x
6969
node-version: "8.17"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package-lock.json
55
*.gz
66

77
# Coveralls
8+
.nyc_output
89
coverage
910

1011
# Benchmarking

appveyor.yml

+12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ install:
5959
} elseif ([int]$env:nodejs_version.split(".")[0] -lt 12) {
6060
npm install --silent --save-dev mocha@8.4.0
6161
}
62+
- ps: |
63+
# nyc for test coverage
64+
# - use 10.3.2 for Node.js < 4
65+
# - use 11.9.0 for Node.js < 6
66+
# - use 14.1.1 for Node.js < 8
67+
if ([int]$env:nodejs_version.split(".")[0] -lt 4) {
68+
npm install --silent --save-dev nyc@10.3.2
69+
} elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {
70+
npm install --silent --save-dev nyc@11.9.0
71+
} elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) {
72+
npm install --silent --save-dev nyc@14.1.1
73+
}
6274
- ps: |
6375
# supertest for http calls
6476
# - use 2.0.0 for Node.js < 4

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@
6868
"eslint": "7.32.0",
6969
"express-session": "1.17.2",
7070
"hbs": "4.2.0",
71-
"istanbul": "0.4.5",
7271
"marked": "0.7.0",
7372
"method-override": "3.0.0",
7473
"mocha": "9.2.0",
7574
"morgan": "1.10.0",
7675
"multiparty": "4.2.2",
76+
"nyc": "15.1.0",
7777
"pbkdf2-password": "1.2.1",
7878
"should": "13.2.3",
7979
"supertest": "6.2.2",
@@ -92,8 +92,8 @@
9292
"scripts": {
9393
"lint": "eslint .",
9494
"test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/",
95-
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/",
96-
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",
95+
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
96+
"test-cov": "nyc --reporter=html --reporter=text npm test",
9797
"test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/"
9898
}
9999
}

0 commit comments

Comments
 (0)