vitest-mocking
CommunityMaster Vitest mocks with confidence.
System Documentation
What problem does it solve?
Vitest mocking patterns and test double strategies. Use when writing tests that need mocks, spies, stubs, or fakes. Triggers include: mocking modules, stubbing globals (fetch, Date, timers), testing composables, mocking imports (default/named), creating test doubles, replacing dependencies, verifying mock calls, cleaning up mocks, or any question about "how do I mock X in Vitest". Also use when reviewing tests for proper mocking practices.
Core Features & Use Cases
- Comprehensive patterns for mocks, spies, stubs, and fakes in Vitest.
- Mock modules, mock globals, verify calls, and clean up mocks across tests.
- Use cases across Vue/React projects, including timers, network, and external dependencies.
Quick Start
Install Vitest in your project and start a test using vi.mock, vi.spyOn, and vi.fn to create deterministic tests. Example: ensure you can mock a module, verify calls, and reset mocks between tests.
Dependency Matrix
Required Modules
None requiredComponents
💻 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: vitest-mocking Download link: https://github.com/alexanderop/workoutTracker/archive/main.zip#vitest-mocking 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 223,000+ vetted skills library on demand.