vitest-mock-implementation-persistence

Community

Prevent cross-test mock leakage in Vitest

AuthorDavidTeju
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Flaky Vitest tests caused by lingering mock implementations across test boundaries, leading to false failures and brittle suites.

Core Features & Use Cases

  • Explicitly reset mock implementations between tests to prevent cross-test leakage.
  • Provide guidance for beforeEach patterns to re-setup full mocks after vi.clearAllMocks().
  • Handle scenarios where incomplete mocks cause TypeErrors by restoring a complete mock object.

Quick Start

Place a beforeEach in your test suite to reinitialize mocks with their full implementations.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 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-mock-implementation-persistence
Download link: https://github.com/DavidTeju/shared-skills/archive/main.zip#vitest-mock-implementation-persistence

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.