Skip to main content
Jeden Skill in Manus ausführen
mit einem Klick

vitest-esm-class-mock

Sterne2
Forks0
Aktualisiert7. April 2026 um 09:57

How to mock class constructors (like WebClient from @slack/web-api) in vitest v4 with ESM modules. Trigger: tests fail with "mock is not being treated as a constructor" or `new ClassName()` returns undefined after vi.clearAllMocks(). Solves the problem of vi.fn().mockImplementation() losing its implementation across test lifecycle hooks.

Installation

Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.

SKILL.md
readonly