testing-anti-patterns

Detect testing anti-patterns in JavaScript/TypeScript test suites and propose fixes.

Updated Dec 9, 2025
One-click install
npx skills add https://github.com/h4v1d/extension-collection-geminicli --skill testing-anti-patterns-h4v1d
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-anti-patterns
Source: https://github.com/h4v1d/extension-collection-geminicli/tree/main/testing-anti-patterns
Command: npx skills add https://github.com/h4v1d/extension-collection-geminicli --skill testing-anti-patterns-h4v1d

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams recognize and address common testing anti-patterns that undermine test reliability, readability, and maintainability by focusing on real behavior rather than mock behavior.

Core Features & Use Cases

  • Anti-pattern detection: Identify patterns like testing mock behavior, incomplete mocks, over-mocking, integration tests as afterthought, and lack of real-behavior verification.
  • Guided refactors: Provide concrete fixes and gate-questions to prevent future occurrences and align with TDD principles.
  • Educational guidance: Illustrate best practices with practical examples and actionable recommendations for teams.

Quick Start

Analyze a test suite and return actionable recommendations. Prioritize anti-patterns, propose concrete fixes, and outline gate rules to apply in future work. Example: Provide a concise plan to convert mock-based tests into real-behavior tests and remove production pollution with test-only helpers.

Frequently Asked Questions about testing-anti-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are common unit testing anti-patterns in JavaScript and TypeScript?

Common testing anti-patterns include over-mocking, testing mock behavior instead of real behavior, incomplete mocks, treating integration tests as an afterthought, and polluting production code with test-only helpers.

How do I fix tests that rely too heavily on mocks?

To fix over-mocking, you should refactor tests to verify real behavior rather than mock interactions. This involves converting mock-based tests into real-behavior tests and removing production pollution with dedicated test utilities.

How do you refactor test suites to align with TDD principles?

Refactoring test suites involves analyzing the code for anti-patterns, proposing concrete fixes, and establishing gate rules to prevent future occurrences. This promotes TDD by guiding teams toward real-behavior verification.

When should I use integration tests instead of unit tests?

Integration tests should be used to verify real behavior across multiple components, rather than treating them as an afterthought. They prevent over-mocking issues common in unit tests and ensure software reliability.

Does this testing guidance apply to my end-to-end test suite?

Yes, this guidance applies to unit, integration, and end-to-end tests across JavaScript and TypeScript projects. It helps identify misused test utilities and prevents production code pollution in all test layers.