What problem does it solve? Vitest 4 introduced breaking changes—removed coverage options, deprecated workspace configs, new Browser Mode provider factories, and sealed ESM namespaces—that cause older test setups and AI-generated tests to fail. This Skill provides verified Vitest 4 patterns that prevent hanging runs, broken coverage, mock leakage, and migration errors. ## Core Features & Use Cases - Configuration & Migration: Set up vitest.config.ts with projects, V8/Istanbul coverage via coverage.include, and migrate from Jest or deprecated workspace-style configs. - Type-Safe Mocking: Implement module, function, global, and environment mocks using vi.mock(import(...)), vi.fn, vi.spyOn, and config-driven cleanup with restoreMocks and unstubEnvs. - Browser Mode Testing: Configure Playwright, WebdriverIO, or Preview providers with Vitest 4 factory imports, and write realistic interaction tests using page and userEvent from vitest/browser. - Use Case: After upgrading to Vitest 4, your coverage report misses untested files and browser spies throw errors. Use this Skill to replace removed coverage.all with coverage.include globs and swap vi.spyOn for vi.mock(import('./mod'), { spy: true }). ## Quick Start Ask the AI to create a Vitest 4 config with V8 coverage and a type-safe module mock for your test file, then verify it with npx vitest run.