Skip to content

Commit a9f2600

Browse files
ChALkeRnkreeger
authored andcommitted
Add coverage reports using nyc (#110)
This adds a `npm run coverage` script. It does not introduce Travis + coveralls.io/codecov.io integration yet, this is just the first step aimed at getting coverage reports locally. Has two reporters enabled: `text-summary` (to console) and `html` (detailed output written to `./coverage/` dir). `instrument` is required for coverage to work `sourceMap` is required for proper source highlighting. `cache` seems to be broken in ts-node setup, so it is explicitly disabled. All *.ts files from `src/` directory are analyzed, excluding tests.
1 parent e71d8ae commit a9f2600

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ yalc.lock
77
.yalc/
88
demo/train-*
99
*.log
10+
.nyc_output/
11+
coverage/

.nycrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extension": [
3+
".ts"
4+
],
5+
"reporter": [
6+
"html",
7+
"text-summary"
8+
],
9+
"include": [
10+
"src/**/*"
11+
],
12+
"exclude": [
13+
"src/run_tests.ts",
14+
"src/**/*_test.ts"
15+
],
16+
"cache": false,
17+
"sourceMap": true,
18+
"instrument": true
19+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"build-npm": "./scripts/build-npm.sh",
1818
"lint": "tslint -p . -t verbose",
1919
"test": "ts-node src/run_tests.ts",
20+
"coverage": "nyc ts-node src/run_tests.ts",
2021
"link-local": "yalc link",
2122
"publish-local": "yarn prep && yarn build && yalc push"
2223
},
@@ -28,6 +29,7 @@
2829
"@types/rimraf": "~2.0.2",
2930
"clang-format": "~1.2.2",
3031
"jasmine": "~3.1.0",
32+
"nyc": "^12.0.2",
3133
"ts-node": "~5.0.0",
3234
"tslint": "~5.9.1",
3335
"typescript": "~2.7.2",

0 commit comments

Comments
 (0)