Skip to content

Commit 6151e7b

Browse files
committed
test(coverage): add test coverage with overalls
1 parent 2f557e0 commit 6151e7b

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ typings/
5757
# dotenv environment variables file
5858
.env
5959

60+
.coveralls.yml

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ before_script:
1111
script:
1212
- npm run test
1313

14+
after_success:
15+
- npm run coverage
16+
1417
#指定分支,只有指定的分支提交时才会运行脚本
1518
branches:
1619
only:

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## koa2-validation
22
[![npm](https://img.shields.io/npm/dt/koa2-validation.svg)](https://www.npmjs.com/package/koa2-validation)
33
[![Build Status](https://api.travis-ci.org/gedennis/koa2-validation.svg?branch=master&name=dennis)](https://travis-ci.org/gedennis/koa2-validation)
4+
[![Coverage Status](https://coveralls.io/repos/github/gedennis/koa2-validation/badge.svg?branch=master)](https://coveralls.io/github/gedennis/koa2-validation?branch=master)
45
koa2-validation is a koa2 middleware to validate the request with Joi. Support `body`, `params`, `query` for Now.
56
Inspired by [express-validation](https://github.com/andrewkeig/express-validation).
67

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "A koa2 middleware to validate the request with Joi.",
55
"main": "index.js",
66
"scripts": {
7-
"test": "ava -v",
7+
"test": "nyc ava -v",
8+
"coverage": "nyc report --reporter=text-lcov | coveralls",
9+
"coverage_local": "nyc report --reporter=html",
810
"release": "standard-version"
911
},
1012
"ava": {
@@ -36,9 +38,11 @@
3638
},
3739
"devDependencies": {
3840
"ava": "^0.19.0",
41+
"coveralls": "^2.13.1",
3942
"koa": "^2.3.0",
4043
"koa-bodyparser": "^4.2.0",
4144
"koa-router": "^7.2.1",
45+
"nyc": "^11.1.0",
4246
"standard-version": "^4.2.0",
4347
"supertest": "^3.0.0"
4448
}

0 commit comments

Comments
 (0)