SKILL.md
Mutation Testing
Expert knowledge for mutation testing - validating that your tests actually catch bugs by introducing deliberate code mutations.
Core Concept
- Mutants: Small code changes introduced automatically
- Killed: Test fails with mutation (good - test caught the bug)
- Survived: Test passes with mutation (bad - weak test)
- Score: Percentage of mutants killed (aim for 80%+)
TypeScript/JavaScript (Stryker)
Vitest Runner
Installation
# Using Bun
bun add -d @stryker-mutator/core @stryker-mutator/vitest-runner
# Using npm
npm install -D @stryker-mutator/core @stryker-mutator/vitest-runner
Configuration
// stryker.config.mjs
export default {
packageManager: 'bun',
reporters: ['html', 'clear-text', 'progress'],
testRunner: 'vitest',
coverageAnalysis: 'perTest',
mutate: ['src/**/*.ts', '!src/**/*.test.ts'],
thresholds: { high: 80, low: 60, break: 60 },
incremental: true,
}
Bun Native Runner (bun test)
Use when projects use bun test directly (not Vitest).
Requirements
- Bun >= 1.3.7 (needs TestReporter WebSocket events from Bun PR #25986)
@stryker-mutator/core ^9.6.1
Installation
bun add -D @hughescr/stryker-bun-runner @stryker-mutator/core
Configuration
// stryker.conf.mjs
export default {
testRunner: 'bun',
coverageAnalysis: 'perTest',
mutate: ['src/**/*.ts', '!src/**/*.test.ts'],
thresholds: { high: 80, low: 60, break: 60 },
incremental: true,
bun: {
inspectorTimeout: 5000, // WebSocket Inspector connection timeout (ms)
// bunPath: '/path/to/bun', // only if custom Bun install
// timeout: 30000, // test timeout (ms)
// env: { DEBUG: 'true' },
// bunArgs: ['--bail'],
},
}
