Skip to content

Commit 879bcab

Browse files
SombreroElGringoHyunje Jun
authored andcommitted
Test coverage (#78)
• Show the code coverage once the tests runned • Generate a repository ./coverage with a report about your code coverage • Publish the code coverage on coveralls once the tests finished on Travis
1 parent b884dba commit 879bcab

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_js:
33
- "4"
44
- "6"
55
- "8"
6+
after_success: npm run coverage

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# line-bot-sdk-nodejs
22

3-
[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs) [![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk)
3+
[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs)
4+
[![Coverage Status](https://coveralls.io/repos/github/line/line-bot-sdk-nodejs/badge.svg?branch=master)](https://coveralls.io/github/line/line-bot-sdk-nodejs?branch=master)
5+
[![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk)
46

57
Node.js SDK for LINE Messaging API
68

package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
],
1515
"scripts": {
1616
"pretest": "npm run build",
17-
"test": "API_BASE_URL=http://localhost:1234/ TEST_PORT=1234 TS_NODE_CACHE=0 mocha -r ts-node/register test/*.spec.ts",
17+
"test": "API_BASE_URL=http://localhost:1234/ TEST_PORT=1234 TS_NODE_CACHE=0 nyc mocha",
18+
"coverage": "nyc report --reporter=text-lcov | coveralls",
1819
"prettier": "prettier --parser typescript --trailing-comma all \"{lib,test}/**/*.ts\"",
1920
"format": "npm run prettier -- --write",
2021
"format:check": "npm run prettier -- -l",
@@ -47,14 +48,30 @@
4748
"devDependencies": {
4849
"@types/express": "^4.0.35",
4950
"@types/mocha": "^2.2.41",
51+
"coveralls": "^3.0.2",
5052
"del-cli": "^1.1.0",
5153
"express": "^4.16.3",
5254
"gitbook-cli": "^2.3.2",
5355
"husky": "^0.14.3",
5456
"mocha": "^5.2.0",
57+
"nyc": "^12.0.2",
5558
"prettier": "^1.8.2",
5659
"ts-node": "^3.3.0",
5760
"typescript": "^2.6.1"
5861
},
62+
"nyc": {
63+
"require": [
64+
"ts-node/register"
65+
],
66+
"extension": [
67+
".ts"
68+
],
69+
"reporter": [
70+
"lcov",
71+
"text-summary"
72+
],
73+
"sourceMap": true,
74+
"instrument": true
75+
},
5976
"license": "Apache-2.0"
6077
}

test/mocha.opts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--require ts-node/register
2+
test/*.spec.ts

0 commit comments

Comments
 (0)