mock-generator

Generate test mocks, stubs, and fixtures for JavaScript/TypeScript and Python projects.

6|2|Updated Oct 31, 2025
One-click install
npx skills add https://github.com/Dexploarer/claudius-skills --skill mock-generator
Or copy as Structured Prompt for Agentโ–ผ
Please help me install this Agent Skill.
Skill: mock-generator
Source: https://github.com/Dexploarer/claudius-skills/tree/main/examples/beginner/testing-skills/mock-generator
Command: npx skills add https://github.com/Dexploarer/claudius-skills --skill mock-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

๐Ÿ’ก This Skill requires jest, vitest, msw, faker-js, jest-mock-extended, mongodb-memory-server, @prisma/client, chai, ethers, hardhat, @testing-library/react, @testing-library/jest-dom, react.

What problem does it solve?

Writing effective test mocks, stubs, and fixtures is crucial for isolated, fast, and reliable tests, but it can be repetitive and error-prone. This Skill automates the creation of these test doubles, saving development time and improving test quality.

Core Features & Use Cases

  • Multi-Framework Support: Generates mocks for popular JavaScript/TypeScript frameworks (Jest, Vitest) and Python (unittest.mock, pytest).
  • Diverse Mock Types: Supports mocking functions, classes, modules, API responses (with MSW), databases (Prisma, MongoDB), and React components/hooks.
  • Use Case: "Create a Jest mock for the fetchUser function that returns a specific user object on success and throws an error on failure."

Quick Start

Generate a Jest mock for the getUserProfile function that returns { id: 1, name: 'Alice' }.

Frequently Asked Questions about mock-generator

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

FAQPage Schema
How do I generate test mocks for Jest and Vitest projects?โ–ผ

Generate test mocks by defining the function or module to mock and specifying the return value or behavior. The Skill creates Jest and Vitest mocks automatically, handling setup and assertion patterns for unit and integration tests without manual boilerplate.

Can I generate mocks for API responses and database queries?โ–ผ

Yes, the Skill generates API mocks using MSW (Mock Service Worker) and database mocks for Prisma and MongoDB. It creates realistic fixtures and stubs that integrate with your test framework, covering both REST endpoints and database operations.

What mock types does this support for React component testing?โ–ผ

The Skill generates mocks for React components and hooks, compatible with @testing-library/react. It produces component stubs, hook mocks, and fixture data that isolate components for focused unit tests.

How do I create mocks for Python pytest projects?โ–ผ

Generate pytest mocks by specifying the module or function to mock. The Skill produces unittest.mock stubs and pytest fixtures with realistic test data, applying the same patterns across Python and JavaScript frameworks.

Does this work with class and module mocking?โ–ผ

The Skill generates mocks for classes, modules, and functions across Jest, Vitest, and pytest. It handles constructor behavior, method stubs, and module-level mocks, supporting both partial and full object mocking.

Can I use this with MongoDB and Prisma databases?โ–ผ

Yes, the Skill generates database mocks for Prisma and MongoDB, including mongodb-memory-server integration. It creates fixtures that simulate database responses and transactions for isolated integration testing.