You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on issues labeled `test-coverage`, read `.github/copilot-test-coverage.md` before starting — it contains the mandatory self-audit protocol, test quality rules, and scope constraints for coverage work.
? `\n\n> **${remainingCount} additional files** are also below threshold. They will appear here once the files above improve.`
89
+
: '';
90
+
82
91
constissueBody=`\
83
92
## Coverage below ${THRESHOLD}% threshold
84
93
@@ -108,14 +117,13 @@ ${fileList}
108
117
For each file:
109
118
1. Read the source file fully before writing any test
110
119
2. Identify the module's exported API surface
111
-
3. Write tests in \`test/unit-tests/\` that cover the uncovered branches
120
+
3. Write tests in \`test/unit-tests/backend/\` that cover the uncovered branches
112
121
4. Run the self-audit steps from \`copilot-test-coverage.md\`
113
122
5. Only open the PR after every self-audit step passes
114
123
115
124
### Self-audit checklist (must be checked before opening PR)
116
125
117
126
- [ ] \`yarn backendTests\` passes with no new failures
118
-
- [ ] \`yarn unitTests\` passes with no new failures
119
127
- [ ] Each file listed above improved by ≥ 10 percentage points OR reached ≥ ${THRESHOLD}% line coverage
120
128
- [ ] No test uses \`assert.ok(true)\` or is an empty stub
121
129
- [ ] Test names describe behavior: \`'expandString handles undefined variable'\` not \`'test 1'\`
@@ -125,34 +133,64 @@ For each file:
125
133
- [ ] \`yarn lint\` passes
126
134
- [ ] \`CHANGELOG.md\` has an entry under \`Improvements:\`
127
135
136
+
### Scope and testability
137
+
138
+
Coverage is collected only from \`yarn backendTests\` (\`test/unit-tests/backend/\`).
139
+
New tests **must** go in \`test/unit-tests/backend/\` and run in plain Node.js (no VS Code host).
140
+
141
+
- If a \`src/\` file can be imported directly (no \`vscode\` dependency at import time), write backend tests for it.
142
+
- If a file deeply depends on \`vscode\` APIs (e.g., \`extension.ts\`, \`projectController.ts\`, UI modules), **skip it** — add a comment in the PR noting it needs integration-test coverage instead.
143
+
- Pure logic modules (\`expand.ts\`, \`shlex.ts\`, \`cache.ts\`, \`diagnostics/\`, \`preset.ts\`) are ideal targets.
144
+
${remainingNote}
145
+
128
146
### Constraints
129
147
130
-
- Tests go in \`test/unit-tests/\` — use Mocha \`suite\`/\`test\` with \`assert\`
148
+
- Tests go in \`test/unit-tests/backend/\` — use Mocha \`suite\`/\`test\` with \`assert\`
149
+
- Validate with \`yarn backendTests\`, not \`yarn unitTests\` (which requires a VS Code host)
131
150
- Import source under test via the \`@cmt/\` path alias
132
151
- Do **not** open the PR as a draft if the self-audit fails — fix it first
133
152
- Do **not** touch source files outside \`test/\`
134
153
`;
135
154
136
155
// ── 5. Ensure the test-coverage label exists ─────────────────────────────────
137
156
try{
138
-
execSync(
139
-
`gh label create test-coverage --repo ${REPO} --color 0075ca --description "Opened by the coverage agent" --force`,
0 commit comments