Skip to main content
Ejecuta cualquier Skill en Manus
con un clic

vitest-esm-class-mock

Estrellas2
Forks0
Actualizado7 de abril de 2026 a las 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.

Instalación

Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.

SKILL.md
readonly