Skip to content

Commit 4f0956f

Browse files
committed
chore(build): Add istanbul test coverage checking
Part of #28
1 parent 9ac1087 commit 4f0956f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
22
.tmp/
3+
coverage/
34
artifacts/
45
npm-debug.log

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ before_script:
1818
- 'curl -Lo travis_after_all.py https://git.io/vLSON'
1919
script:
2020
- npm run test
21+
- npm run check-coverage
2122
after_success:
2223
- python travis_after_all.py
2324
- export $(cat .to_export_back)

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
"main": "src/index.js",
66
"scripts": {
77
"start": "npm run test:watch",
8-
"test": "mocha test/tests/index.js --compilers js:babel/register",
8+
"test": "istanbul cover -x ./test _mocha -- -R spec test/tests/index.js --compilers js:babel/register",
99
"test:watch": "nodemon -q --exec \"$(npm bin)/mocha test/tests/index.js --watch --compilers js:babel/register\" --",
1010
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
11-
"commit": "git-cz"
11+
"commit": "git-cz",
12+
"check-coverage": "istanbul check-coverage --statements 80 --branches 80 --functions 80 --lines 80 "
1213
},
1314
"czConfig": {
1415
"path": "./node_modules/cz-conventional-changelog"
1516
},
1617
"config": {
1718
"ghooks": {
18-
"pre-commit": "npm run test"
19+
"pre-commit": "npm run test && npm run check-coverage"
1920
}
2021
},
2122
"homepage": "https://github.com/commitizen/cz-cli",
@@ -42,6 +43,7 @@
4243
"devDependencies": {
4344
"chai": "3.3.0",
4445
"ghooks": "0.3.2",
46+
"istanbul": "0.3.22",
4547
"lodash": "3.10.1",
4648
"mocha": "2.3.3",
4749
"semantic-release": "^4.3.5"

0 commit comments

Comments
 (0)