Mutation Testing & Missing Branch Coverage Finder
Audit test suites by simulating mutant bugs (flipped conditionals, off-by-one errors) to expose weak assertions.
Interactive Prompt Playground
{{SOURCE_CODE}}{{TEST_SUITE}}You are a Mutation Testing Specialist and Code Quality Auditor.
Source Code:
```
export function isValidPassword(password: string): boolean {
if (!password || password.length < 8) return false;
const hasUpper = /[A-Z]/.test(password);
const hasLower = /[a-z]/.test(password);
const hasDigit = /[0-9]/.test(password);
return hasUpper && hasLower && hasDigit;
}
```
Existing Test Suite:
```
it('validates good password', () => {
expect(isValidPassword('P@ssword123')).toBe(true);
});
it('rejects short password', () => {
expect(isValidPassword('Abc1')).toBe(false);
});
```
Perform a simulated mutation testing analysis to find surviving mutants and weak assertions:
1. **Mutant Generation & Kill Analysis**:
- Generate 5-8 realistic code mutations (e.g. changing `>` to `>=`, swapping boolean logic, removing method calls, changing constant return values).
- Check whether the existing test suite would fail (Kill the mutant) or pass (Survive).
2. **Surviving Mutants (Weak Test Gaps)**:
- Identify all surviving mutants where the test suite gave false confidence.
- Explain why the current assertions failed to catch the bug.
3. **Strengthened Test Cases**:
- Provide the exact new test cases required to achieve 100% mutation score and kill every mutant.How to Use This Prompt
- Paste your implementation code alongside your existing unit tests.
- Get a list of simulated mutants that slipped through and the tests needed to kill them.
Engineering Tips & Best Practices
- High line coverage does not equal high test quality. Mutation testing proves whether your assertions actually verify behavior.
What This Prompt Inspects
Key failure modes, design principles, and quality standards evaluated during execution.
Surviving Mutant Detection
Discovers branches where modifying logic still results in green tests.
Assertion Strength
Replaces vague toBeDefined() checks with strict equality and boundary assertions.
False Confidence Elimination
Ensures code coverage translates to genuine bug-catching capability.
SprintKit Workflow Integrations
Complementary interactive tools and workflows across SprintKit to accelerate your engineering process.
Related Prompts
Explore related developer prompts in this workflow domain.
Unit Test Suite Generator with Edge Cases
Generate comprehensive, mutation-tested unit tests with AAA pattern, boundary cases, and proper mock boundaries.
Flaky Test & Async Timing Race Condition Debugger
Fix nondeterministic test failures, unhandled async promises, and race conditions in Playwright, Jest, or Vitest.
TypeScript Strict Type Safety & Clean Code Review
Audit TypeScript code for type safety, type narrowing, generics, mutation traps, and runtime boundary leaks.