Mutation testing with mutmut and StrykerJS to check whether tests actually verify behavior
A developer noticed that a pull request with 94% coverage and passing CI still let code changes slip through, since altering a comparison operator or replacing a return value left the tests green. Coverage only shows which lines run, not whether tests check the results. The article introduces mutation testing, where tools generate small faulty versions of code called mutants and check whether the test suite catches them. It demonstrates the approach in Python with mutmut on a shipping fee function, showing how weak assertions and missing boundary cases let mutants survive. The author also outlines StrykerJS configuration for JavaScript and TypeScript projects, highlighting per-test coverage analysis and incremental runs to keep execution fast.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in