Skip to content

Commit f67e6f6

Browse files
committed
ci: add code coverage with 80% line threshold
Add test:coverage npm script using Node.js built-in test coverage with --test-coverage-lines=80 threshold. Excludes thin VS Code API wrapper files (extension.ts, statusBar.ts, configureMcp.ts, setupWorkspace.ts, showStatus.ts) that are tested by integration tests rather than unit tests. Add coverage check step to CI workflow (Linux-only in unit-test job). Include coverage in the npm run check gate. Current coverage: 82.65% line, 86.27% branch, 86.69% function. Closes #61 Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent db0086f commit f67e6f6

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ jobs:
3838
- name: Run tests
3939
run: npm test
4040

41+
- name: Check code coverage
42+
if: matrix.os == 'ubuntu-latest'
43+
run: npm run test:coverage
44+
4145
build:
4246
runs-on: ubuntu-latest
4347
timeout-minutes: 10

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ Patchloom for VS Code is the official VS Code extension for [Patchloom](https://
1616
| `npm run test:ui` | Run ExTester UI tests (downloads VS Code if needed) |
1717
| `npm run test:all` | Compile + unit tests + extension integration tests |
1818
| `npm run test` | Compile + compile-tests + unit tests |
19+
| `npm run test:coverage` | Unit tests with line coverage (80% threshold) |
1920
| `npm run package` | Package the `.vsix` using `@vscode/vsce` |
20-
| `npm run check` | Full CI gate: test + package |
21+
| `npm run check` | Full CI gate: test + coverage + package |
2122

2223
Always run `npm run check` before committing.
2324

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,14 @@
140140
"compile-uitests": "tsc -p ./tsconfig.uitest.json",
141141
"watch": "tsc -watch -p ./",
142142
"test:unit": "node --test ./out-test/test/unit/*.test.js",
143+
"test:coverage": "node --test --experimental-test-coverage --test-coverage-lines=80 --test-coverage-exclude='out-test/src/extension*' --test-coverage-exclude='out-test/src/commands/showStatus*' --test-coverage-exclude='out-test/src/commands/configureMcp*' --test-coverage-exclude='out-test/src/commands/setupWorkspace*' --test-coverage-exclude='out-test/src/status/statusBar*' ./out-test/test/unit/*.test.js",
143144
"test:extension": "node ./out-test/test/suite/runExtensionTests.js",
144145
"test:ui": "npm run compile && npm run compile-uitests && extest setup-and-run './out-uitest/test/ui/*.test.js' --code_version max --extensions_dir .vscode-test/extensions",
145146
"test": "npm run compile && npm run compile-tests && npm run test:unit",
146147
"test:all": "npm run compile && npm run compile-tests && npm run test:unit && npm run test:extension",
147148
"vscode:prepublish": "npm run compile",
148149
"package": "vsce package",
149-
"check": "npm run test && npm run package"
150+
"check": "npm run test && npm run test:coverage && npm run package"
150151
},
151152
"overrides": {
152153
"mocha": {

0 commit comments

Comments
 (0)