agentleFS
DobroslavRadosavljevicDobroslavRadosavljevic/cabrakan/.agents/skills/vitest/SKILL.md

vitest

Skill1 starsChanged 3 months agoMITView on GitHub

Build, review, debug, configure, migrate, teach, or plan Vitest testing with current docs and a full usage guide. Use for vitest, vitest.config, defineConfig from vitest/config, describe/it/test/expect, vi mocks, snapshots, coverage (@vitest/coverage-v8), browser mode (@vitest/browser-playwright), projects, pools/maxWorkers, reporters, UI, bench, typecheck, and Jest or Vitest 3 to Vitest 4 migration.

54 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use nitro, react-hook-form and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    nitro

    Build and deploy universal JavaScript servers with Nitro v3. Use when working with nitro.config.ts, defineNitroConfig, defineHandler, defineConfig, server.ts entry, filesystem routing, route rules, useStorage, defineCachedHandler, useDatabase, definePlugin, runtime hooks, Vercel/Cloudflare deployment, or migrating from Nitro v2/nitropack.

    Also in 5 projects that use this

  • SupabaseSkill

    react-hook-form

    Correct React Hook Form usage anywhere in the monorepo — data flow, subscriptions,

    Also in 3 projects that use this

  • midudevSkill

    tailwind-css-patterns

    Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.

    Also in 4 projects that use this

  • xenitV1Skill

    nodejs-best-practices

    Node.js development principles and decision-making. Framework selection, async patterns, security, and architecture. Teaches thinking, not copying.

    Also in 5 projects that use this

  • VercelSkill

    next-cache-components

    Next.js 16 Cache Components - PPR, use cache directive, cacheLife, cacheTag, updateTag

    Also in 4 projects that use this

  • nicepkgSkill

    tailwind-v4-shadcn

    Production-tested setup for Tailwind CSS v4 with shadcn/ui, Vite, and React.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when work touches Vitest: writing/running tests, config, mocks/snapshots, coverage, browser mode, projects/pools, reporters, …

    line 8
  2. Very specific:

    Prefer Vitest 4.x APIs (projects, maxWorkers, browser provider factories).

    line 24
  3. Very specific:

    Verify with the narrowest useful command (vitest run path -t "name", coverage, or browser project).

    line 25
  4. Very specific:

    Import from vitest unless globals: true.

    line 31
  5. Very specific:

    Default pool is forks. Prefer it over threads when native addons misbehave.

    line 34
  6. Distinctive:

    Prefer repository-owned commands.

    line 42

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Vitest

Use this skill when work touches Vitest: writing/running tests, config, mocks/snapshots, coverage, browser mode, projects/pools, reporters, or migrating from Jest / Vitest 3.

Workflow

  1. Inspect the local Vitest surface:
    • Package versions: vitest and aligned @vitest/* (snapshot 4.1.10). Node ^20 || ^22 || >=24. Vite peer ^6 || ^7 || ^8.
    • Config: dedicated vitest.config.* (overrides vite.config entirely) vs test: {} inside Vite config.
    • Scripts: prefer vitest run for CI; do not use bun test (Bun’s runner) when the project uses Vitest — use bun run test / bunx vitest.
    • Environment: node (default) vs jsdom / happy-dom vs Browser Mode projects.
  2. For day-to-day how-to, follow usage-guide.md first.
  3. Refresh docs when versions drift or the task is browser/coverage/migration. Start from source-map.md.
  4. Route deeper detail:
    • Config, CLI, test API, environments, setup: config-cli-api.md.
    • vi mocks, timers, env stubs, snapshots: mocking-snapshots.md.
    • Coverage, browser mode, projects, pools, reporters: coverage-browser-projects.md.
    • Jest / Vitest 3 → 4: migration.md.
  5. Prefer Vitest 4.x APIs (projects, maxWorkers, browser provider factories). Keep @vitest/* packages on the same version as vitest.
  6. Verify with the narrowest useful command (vitest run path -t "name", coverage, or browser project).

Core Judgment

  • Vitest is a Vite-powered test runner with a Jest-compatible API — not Bun’s built-in bun test.
  • CI / hooks: always vitest run (or --run). Plain vitest watches and hangs non-interactively unless CI/non-TTY forces run.
  • Import from vitest unless globals: true. Prefer explicit imports for agent clarity.
  • vi.mock / vi.hoisted are hoisted — factories cannot close over non-hoisted locals.
  • Concurrent tests + snapshots/asserts: use context expect from the test callback, not global expect.
  • Default pool is forks. Prefer it over threads when native addons misbehave.
  • A dedicated vitest.config.* ignores vite.config options — use mergeConfig when extending Vite plugins/aliases.
  • Coverage is root-only in projects; set coverage.include explicitly (v4 no longer has coverage.all).
  • Browser Mode is not environment: 'jsdom' — use browser.enabled + provider packages.
  • Vite transforms tests but does not typecheck — use optional typecheck or project tsc separately.

Verification

Prefer repository-owned commands. For meaningful Vitest work, cover the relevant subset:

  • bunx vitest --version and confirm @vitest/* version alignment.
  • Focused vitest run <file> -t "<name>" (or :line filter).
  • Snapshot updates only with deliberate -u / watch u; review diffs.
  • Coverage: vitest run --coverage when thresholds or reports matter.
  • Browser project: headless chromium smoke when UI/component tests change.
  • Migration: no remaining workspace, string browser providers, poolOptions, or test(name, fn, options).

Report which checks ran, which did not, and any Vitest version assumptions that remain.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.