mock-detection

Analyze test files for T1-T4 mock usage violations across unit, integration, and E2E tests.

2|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/ashaykubal/essential-agents-skills --skill mock-detection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-detection
Source: https://github.com/ashaykubal/essential-agents-skills/tree/main/skills/mock-detection
Command: npx skills add https://github.com/ashaykubal/essential-agents-skills --skill mock-detection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill identifies inappropriate or excessive use of mocks in your test suite, ensuring your tests accurately reflect real-world behavior and provide reliable confidence.

Core Features & Use Cases

  • Mock Appropriateness Analysis: Evaluates if mocks are used correctly based on test type (unit, integration, E2E).
  • Violation Detection: Identifies specific anti-patterns like mocking the system under test (T1) or verifying calls without results (T2).
  • Use Case: When running your test suite, this Skill can pinpoint tests that use mocks in a way that gives a false sense of security, helping you refactor them for true effectiveness.

Quick Start

Analyze the test file 'tests/user.test.ts' for mock appropriateness.

Frequently Asked Questions about mock-detection

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

FAQPage Schema
How do I detect inappropriate mock usage in my unit tests?

To detect inappropriate mock usage in unit tests, analyze test files to identify violations of testing best practices. This Skill evaluates mock appropriateness based on test type, pinpointing anti-patterns like mocking the system under test to ensure your tests reflect real-world behavior.

What are common mock anti-patterns that cause false test confidence?

Common mock anti-patterns causing false test confidence include T1-T4 violations, such as mocking the system under test or verifying mock calls without asserting results. Identifying these specific anti-patterns helps refactor tests to accurately reflect real-world behavior.

How do I analyze an integration test file for mocking best practices?

To analyze an integration test file for mocking best practices, pass the file to a mock analysis process. It evaluates if mocks are used correctly based on the test type, identifying violations and prioritizing findings by severity to maintain test confidence.

Does mock appropriateness analysis work for end-to-end tests?

Yes, mock appropriateness analysis works for end-to-end tests. It evaluates mock usage correctness across unit, integration, and E2E test types, identifying specific anti-patterns and prioritizing findings based on severity and impact on overall test confidence.

When should I audit my test suite for excessive mock usage?

You should audit your test suite for excessive mock usage when tests provide a false sense of security. A test audit identifies T1-T4 violations and prioritizes findings by severity, helping you refactor mocks for true effectiveness and reliable confidence.

What is the best way to refactor tests that mock the system under test?

The best way to refactor tests that mock the system under test is to run a deep mock analysis to identify T1-T4 violations. This analysis tracks violation scope and prioritizes findings by impact, guiding targeted refactoring for true test effectiveness.