What problem does it solve? Vitest tests often suffer from mock state leaking between tests, temporal-dead-zone errors from hoisted vi.mock factories, and hand-rolled call tracking that duplicates what vi.fn() already provides. This Skill defines a consistent mocking style so tests stay isolated, readable, and free of order-dependent failures. ## Core Features & Use Cases - Preferred mocking pattern: Mock modules with vi.fn() per exported function, configure behavior per test with vi.mocked(), and assert calls with toHaveBeenCalledWith instead of hand-rolled state boxes. - vi.hoisted guidance: Explains that vi.hoisted exists only to work around hoisting-order errors, not as a mutable shared state container that couples tests together. - Setup vs per-file mocks: Clarifies what belongs in vitest.setup.ts (framework-wide neutralizations like server-only guards) versus file-specific vi.mock calls. - Reset strategy: Distinguishes vi.clearAllMocks (clears call history, keeps implementations) from vi.resetAllMocks (also clears implementations), run in beforeEach. - Use Case: When reviewing a diff that adds a const { state } = vi.hoisted(...) box mutated by every test, use this Skill to refactor it into per-test vi.mocked() configuration with proper beforeEach resets. ## Quick Start Review my Vitest test file and refactor the vi.hoisted state box into vi.fn and vi.mocked mocks with proper per-test resets.