Tests that prove something: break a copy and see the test fail
A green suite only counts if it can go red. So when a test is written for a fix, the practice in Yonto Player's repo is to revert the fix and watch that test fail, and to break the exact line the test claims to hold. This post is how that loop works, how to run it safely, and what to do with fakes so the loop is cheap. Two questions, both answered by failing There are two claims a change can…
When a test is written to verify a bug fix, the Yonto Player repository practice is to revert the fix and confirm that the test fails. This loop demonstrates the effectiveness of the fix and helps isolate the issue. Two claims can be made about a change: it either addresses a behavior or establishes a rule. The proof for each claim involves a test that fails without the fix (showing the original problem) or requires mutating the code to break a specific rule (demonstrating the new rule holds).
The repository's testing notes provide guidance on how to mutate the code safely and effectively. Mutations should be performed one decision at a time, reverting each change individually to ensure the change is isolated and the test failure accurately reflects the impact of the fix. Break the last item of a loop rather than the first, and check that multiple failures are reported when multiple mutations survive.
If a mutation fails to apply, it indicates the code is untested or the change is ineffective. Use fakes, such as a fake content source with call counters or gates, to speed up the mutation process and make it more precise.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.