vitest-coverage-types-mockslisted
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