Skip to content

Commit e800a07

Browse files
committed
Setup nyc to produce code coverage reports
This extends the public TypeScript configuration and sets it to check just our source files. The `all` setting must be `false` otherwise the tool crashes with an OOM because the test runner launches VS Code instances. The `.vscode-test` folder must be excluded or `nyc` will attempt to instrument Code's own sources. The `out` and `src` folders must both be included so that the TypeScript source mapping works. The coverage check is set to false because we'll enable failures for reduced coverage later. The Cobertura report is for Azure DevOps (cobertura) and a summary is printed to the console.
1 parent 88aa569 commit e800a07

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,26 @@
8383
"lint": "tslint --project tsconfig.json",
8484
"build": "tsc --project tsconfig.json && esbuild ./src/main.ts --outdir=out --sourcemap --bundle --minify --external:vscode --platform=node",
8585
"test": "node ./out/test/runTests.js",
86+
"coverage": "nyc npm run test",
8687
"package": "vsce package --no-gitHubIssueLinking",
8788
"publish": "vsce publish"
8889
},
90+
"nyc": {
91+
"extends": "@istanbuljs/nyc-config-typescript",
92+
"all": false,
93+
"check-coverage": false,
94+
"include": [
95+
"out/**/*.js",
96+
"src/**/*.ts"
97+
],
98+
"exclude": [
99+
".vscode-test/**/*.js"
100+
],
101+
"reporter": [
102+
"cobertura",
103+
"text"
104+
]
105+
},
89106
"contributes": {
90107
"breakpoints": [
91108
{

0 commit comments

Comments
 (0)