Skip to content

Commit 113052a

Browse files
rajbosCopilot
andcommitted
feat(tests): add Stryker mutation testing to VS Code extension
- Install @stryker-mutator/core v9.6.1 as a devDependency - Add stryker.config.mjs targeting compiled JS in out/src/ to avoid a TypeScript recompile step per mutant: - Mutates 7 core logic files (tokenEstimation, sessionParser, maturityScoring, usageAnalysis, utils/*) - Runs 9 explicit unit test files (no shell globs for cross-platform safety) - coverageAnalysis: off with command runner (node:test built-in) - concurrency: 2, timeoutMS: 15000 - Threshold break: 0 (informational during rollout) - HTML report written to reports/mutation/report.html - Add test:mutation npm script: compile-tests then npx stryker run - Add mutation-testing CI job in ci.yml: - Only runs on pull_request events (not push to main) - Depends on build job (tests must pass first) - continue-on-error: true to keep it non-blocking - Hard cap at 20 minutes - Uploads HTML report artifact (14-day retention) - Add .stryker-tmp and reports/mutation/ to .gitignore Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 78bfd77 commit 113052a

5 files changed

Lines changed: 1800 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,51 @@ jobs:
8383
vscode-extension/out/
8484
retention-days: 7
8585

86+
mutation-testing:
87+
runs-on: ubuntu-latest
88+
needs: build
89+
if: github.event_name == 'pull_request'
90+
# Informational — does not block the PR. A failing mutation score
91+
# is visible in the artifact but does not block merging during rollout.
92+
continue-on-error: true
93+
94+
steps:
95+
- name: Harden the runner (Audit all outbound calls)
96+
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
97+
with:
98+
egress-policy: audit
99+
100+
- name: Checkout code
101+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
102+
103+
- name: Setup Node.js
104+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
105+
with:
106+
node-version: '20.x'
107+
cache: 'npm'
108+
cache-dependency-path: vscode-extension/package-lock.json
109+
110+
- name: Install dependencies
111+
working-directory: vscode-extension
112+
run: npm ci
113+
114+
- name: Compile tests
115+
working-directory: vscode-extension
116+
run: npm run compile-tests
117+
118+
- name: Run mutation tests
119+
working-directory: vscode-extension
120+
run: npx stryker run
121+
timeout-minutes: 20
122+
123+
- name: Upload mutation report
124+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
125+
if: always()
126+
with:
127+
name: mutation-report
128+
path: vscode-extension/reports/mutation/
129+
retention-days: 14
130+
86131
package:
87132
runs-on: ubuntu-latest
88133
needs: build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ node_modules
44
.vscode-test/
55
*.vsix
66
*.backup
7+
.stryker-tmp
8+
reports/mutation/
79
.github/scripts/models.txt
810
.github/scripts/scraper.log
911
.github/scripts/scraped-models.json

0 commit comments

Comments
 (0)