← ClaudeAtlas

vitest-coverage-types-mockslisted

How this repo runs Vitest — coverage gate, v8 per-file thresholds, mocking/type-testing patterns. Use for "coverage is failing", "mock this module", or when editing vitest.config.ts, writing/fixing a mock (vi.mock, vi.spyOn, vi.hoisted), or adding expectTypeOf assertions. Pairs with tests.md. Not for generic Vitest questions unrelated to this repo.
monte3l/m3l-automation · ★ 0 · Testing & QA · score 56
Install: claude install-skill monte3l/m3l-automation
# Vitest coverage, types & mocks (m3l-automation) Config lives in [`vitest.config.ts`](../../../vitest.config.ts). The suite runs with `pnpm test` (once) / `pnpm test:coverage` (gated) / `pnpm test:watch`, on Vitest 4 + the v8 coverage provider, ESM + TypeScript native (no CJS layer). ## When to use Editing `vitest.config.ts`, writing/fixing mocks, adding `expectTypeOf` tests, or diagnosing a coverage-gate or mock-hoisting failure. For _what_ to test (happy + failure path, behavior over internals), see the `tests.md` rule — this skill is the mechanics. ## How this repo's config works - **`include`**: `**/tests/**/*.test.ts` and `**/*.test.ts`. - **`exclude`**: `dist`, `node_modules`, and **`.claude/worktrees/**`** — those are nested checkouts of other branches; running their tests from the main tree is wrong. - **Coverage** (`coverage: { provider: "v8", … }`): - `include: packages/*/src/**/*.ts`; `exclude: **/index.ts`, `**/*.d.ts` (barrels/type files carry no logic to cover). - `reporter: ["text", "html", "json"]`. The **`json`** reporter writes `coverage-final.json` — trust it as the per-file source of truth, because the v8 **text table hides files that are 100% on every metric**, which makes a real gap look absent. - `thresholds`: lines 90% / functions 83% / branches 80% / statements 89%, with **`perFile: true`** so each file must individually clear its own threshold (not just the aggregate). - `coverage.all` defaults to **false** i