Skip to content

Commit 4852c92

Browse files
jamestalmagesindresorhus
authored andcommitted
Close #264 PR: Fix coverage.
Due to NYC defaults, we were missing coverage on lib/test.js I also added `npm run coverage` as a build target, which is for use on developer machines. It launches a browser window with coverage from the last run. We no longer need NYC as a dev dependency. `tap` handles it for us. `maintaining.md` updated to reflect all these changes.
1 parent 812589a commit 4852c92

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.gitignore

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

maintaining.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Maintaining
22

33

4+
## Testing
5+
6+
- `npm test`: Lint the code and run the entire test suite with coverage.
7+
- `npm run test-win`: Run the tests on Windows.
8+
- `npm run coverage`: Generate a coverage report for the last test run (opens a browser window).
9+
- `tap test/fork.js --bail`: Run a specific test file and bail on the first failure (useful when hunting bugs).
10+
11+
412
## Release process
513

614
- Bump dependencies.

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
},
3939
"scripts": {
4040
"test": "xo && tap --coverage --reporter=spec --timeout=150 test/*.js",
41-
"test-win": "tap --coverage --reporter=spec --timeout=150 test/*.js",
42-
"coveralls": "nyc report --reporter=text-lcov | coveralls"
41+
"test-win": "tap --reporter=spec --timeout=150 test/*.js",
42+
"coveralls": "tap --coverage-report=text-lcov | coveralls",
43+
"coverage": "tap --coverage-report=lcov"
4344
},
4445
"files": [
4546
"index.js",
@@ -112,10 +113,17 @@
112113
},
113114
"devDependencies": {
114115
"coveralls": "^2.11.4",
115-
"nyc": "^3.2.2",
116116
"signal-exit": "^2.1.2",
117117
"tap": "^2.2.1",
118118
"xo": "*",
119119
"zen-observable": "^0.1.6"
120+
},
121+
"config": {
122+
"nyc": {
123+
"exclude": [
124+
"node_modules[/\\\\]",
125+
"test[/\\\\]"
126+
]
127+
}
120128
}
121129
}

0 commit comments

Comments
 (0)