What problem does it solve?
This Skill helps you avoid common mistakes in test writing that lead to unreliable tests, false positives, and polluted production code. It ensures your tests verify real behavior, not just the behavior of your mocks.
Core Features & Use Cases
- Mock Behavior Prevention: Guides against testing mocks instead of actual code behavior, ensuring your tests provide real confidence.
- Production Code Purity: Prevents adding test-only methods to production classes, keeping your production codebase clean and focused.
- Dependency Understanding: Ensures you mock only when necessary and with a full understanding of the dependency chain, avoiding unintended side effects.
- Use Case: When reviewing or writing new tests, this skill acts as a guardrail, ensuring your tests are effective, maintainable, and don't introduce hidden issues or false confidence.
Quick Start
❌ BAD: Testing mock existence
test('renders sidebar', () => {
render(<Page />);
expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
});
✅ GOOD: Test real component behavior
test('renders sidebar', () => {
render(<Page />);
expect(screen.getByRole('navigation')).toBeInTheDocument();
});