mock-factory
Installation
SKILL.md
Mock Factory
Generates a typed, reusable factory function for mocking a module, class, or interface — with per-test override support and clean reset semantics.
Phase 1: Discovery
Before writing anything, extract:
- Target shape — is it a TS interface, class, or CommonJS/ESM module?
- Test runner — Jest or Vitest? (API is nearly identical; note differences inline)
- Override depth — do tests need to override individual method return values, or whole sub-objects?
- Async surface — are any methods
asyncor returningPromise? - Reset strategy — per-test (
beforeEach) or per-file (beforeAll)?
If the user pastes the interface/class, extract the shape directly. If not, ask for it.