testing-anti-patterns
CommunityAvoid common testing pitfalls, write effective tests.
System Documentation
What problem does it solve?
This Skill helps you avoid common mistakes that lead to brittle, ineffective, or misleading tests. It ensures your tests verify actual code behavior, not just mock interactions, preventing false confidence, wasted effort, and future regressions in your testing strategy.
Core Features & Use Cases
- Prevent Mock Behavior Testing: Learn to assert on real component behavior rather than the existence or actions of mocks, ensuring tests are meaningful and robust.
- Avoid Production Pollution: Keep your production codebase clean by preventing the introduction of methods or code used solely for testing purposes.
- Strategic Mocking: Understand when and how to mock dependencies effectively, ensuring isolation without breaking the test's logic or assumptions about real-world interactions.
- Use Case: You're writing a test for a
Pagecomponent that uses aSidebar. Instead of asserting that asidebar-mockexists, this skill guides you to either test the realSidebarbehavior or, if mocking, to test thePage's interaction with theSidebar's expected output, not the mock itself.
Quick Start
BAD: Testing that the mock exists
test('renders sidebar', () => { render(<Page />); expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument(); });
GOOD: Test real component or don't mock it
test('renders sidebar', () => { render(<Page />); expect(screen.getByRole('navigation')).toBeInTheDocument(); });
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: testing-anti-patterns Download link: https://github.com/chriscarterux/chris-claude-stack/archive/main.zip#testing-anti-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.