Skip to content

Commit 40ff111

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 b3cec99 commit 40ff111

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,26 @@
8282
"scripts": {
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",
85-
"test": "node ./out/test/runTests.js",
85+
"test": "nyc node ./out/test/runTests.js",
8686
"package": "vsce package --no-gitHubIssueLinking",
8787
"publish": "vsce publish"
8888
},
89+
"nyc": {
90+
"extends": "@istanbuljs/nyc-config-typescript",
91+
"all": false,
92+
"check-coverage": false,
93+
"include": [
94+
"out/**/*.js",
95+
"src/**/*.ts"
96+
],
97+
"exclude": [
98+
".vscode-test/**/*.js"
99+
],
100+
"reporter": [
101+
"cobertura",
102+
"text"
103+
]
104+
},
89105
"contributes": {
90106
"breakpoints": [
91107
{

0 commit comments

Comments
 (0)