CLSkills
Testingadvanced

Mutation Testing Setup

Share

Set up mutation testing to verify test quality

Mutation Testing Setup

Set up mutation testing to verify test quality

Set up mutation testing to verify test quality.

Instructions

  1. Install Stryker Mutator:
npm install -D @stryker-mutator/core @stryker-mutator/jest-runner @stryker-mutator/typescript-checker
npx stryker init    # interactive setup
  1. Configure stryker.config.mjs:
export default {
  mutator: { excludedMutations: [] },
  testRunner: 'jest',
  checkers: ['typescript'],
  reporters: ['html', 'progress'],
  coverageAnalysis: 'perTest',
  mutate: ['src/**/*.ts', '!src/**/*.test.ts', '!src/**/*.d.ts'],
};
  1. Run mutation testing:
npx stryker run
  1. Interpret results:

    • Killed: mutation was caught by a test (good)
    • Survived: mutation was NOT caught (you need better tests)
    • No coverage: no test covers this code at all
    • Timeout: mutation caused an infinite loop (usually killed)
  2. For each surviving mutant, write a test that catches it.

Target: mutation score > 80%

Focus on killing mutants in critical business logic — not in boilerplate.

Quick Info

CategoryTesting
Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
testingmutationquality

Install command:

curl -o ~/.claude/skills/mutation-testing-setup.md https://claude-skills-hub.vercel.app/skills/testing/mutation-testing-setup.md