mutation-testing

Run and interpret Stryker mutation testing; kill survivors to reach ≥95% score. Use when running mutation tests, setting up Stryker, interpreting survivors, or verifying test quality after TDD.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "mutation-testing" with this command: npx skills add jonmumm/skills/jonmumm-skills-mutation-testing

Mutation Testing Quality Gate

Use Stryker Mutator to verify that tests actually catch breakage — not just that they pass. Often used after TDD (e.g. in Ralph’s quality gate).

What It Does

Stryker modifies your source code (mutates it) and checks if your tests catch the change. If a mutation survives (tests still pass), there's a gap in your test coverage.

Examples of mutations:

  • > 0>= 0 (boundary condition)
  • a + ba - b (arithmetic operator)
  • if (condition)if (true) (removed conditional)
  • return valuereturn "" (string literal)
  • { ...body }{} (removed block)

If your tests don't catch these, they're not testing real behavior.

Setup (one-time per project)

See references/setup.md: install Stryker packages, add stryker.config.mjs, npm scripts (test:mutate, test:mutate:incremental), and .gitignore entries.

The Quality Gate Workflow

Run after all unit tests pass:

  1. Run Stryker: npm run test:mutate:incremental (first run 10–60 min; incremental 2–5 min).
  2. Read survivors: Clear-text output shows file, line, and what was changed.
  3. Kill survivors on files you touched: understand the mutation → write a targeted test that would fail with the mutation → re-run incremental.
  4. Repeat until mutation score ≥ 95% on touched files. Use thresholds.break: 90 in config to fail the build if you regress.

Survivor table and tips

MutationWhat It MeansHow to Kill
> 0>= 0No test with zero valueAdd test with amount = 0, assert rejection
a + ba - bNo test verifying arithmetic resultAssert exact computed values
if (x)if (true)Condition not tested as falseAdd test where condition is false
return valuereturn ""Return value not assertedAssert the specific return value
{ ...body }{}Block removal not detectedAssert side effects of the block
a.filter(fn)aFilter not testedAdd test with mixed data, assert filtered result
a === ba !== bOnly testing the happy pathTest both matching and non-matching cases
  • Run incremental, not full: After the first baseline, use npm run test:mutate:incremental. Much faster.
  • Focus on your changes: Kill survivors only in code you touched.
  • NoCoverage / CompileError: NoCoverage = add tests later; CompileError = no action.
  • Don't chase 100%: 95% on covered code is excellent.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

react-render-performance

No summary provided by upstream source.

Repository SourceNeeds Review
General

dont-use-use-effect

No summary provided by upstream source.

Repository SourceNeeds Review
General

react-composable-components

No summary provided by upstream source.

Repository SourceNeeds Review