itechmeat/llm-code/vitest
Claude Code and agent skill by itechmeat/llm-code
- community
Checking that the SKILL.md file is still in the repository.
Vitest testing framework: Vite-powered tests, Jest-compatible API, mocking, snapshots, coverage, browser mode, and TypeScript support. Use when writing or configuring tests with Vitest, setting up mocking/snapshots, configuring coverage, or running browser-mode tests. Keywords: Vitest, testing, Vite, Jest, mocking, coverage.
Install
npx vskill@latest install itechmeat/llm-code/vitestSKILL.md
Vitest
Next generation testing framework powered by Vite.
Quick Navigation
- Test API - test, describe, hooks
- Expect API - matchers and assertions
- Mocking - vi.fn, vi.mock, fake timers
- Configuration - vitest.config.ts options
- CLI - command line reference
- Browser Mode - real browser testing
When to Use
- Testing Vite-based applications (shared config)
- Need Jest-compatible API with native ESM support
- Component testing in real browser
- Fast watch mode with HMR
- TypeScript testing without extra config
- Parallel test execution
Installation
Install: npm install -D vitest. Requires Node.js >=22 and Vite >=6.4 in v5.
Release Highlights (5.0.0)
- Requirements: Node.js >=22 and Vite >=6.4 are required.
@vitest/runneris inlined (the package is no longer published) andexpectis inlined, so old entry points were removed. - Mock/timer behavior: mocks are cleared by default before each test, and
Temporalcan now be mocked (with or without fake timers). - Replaced APIs:
sequentialtest/suite options are removed in favor ofconcurrent; thewebdriveriobrowser provider is removed;toHaveTextContentis strict withtoMatchTextContentas the alternative;expect.pollfails when the function does not resolve in time. - New defaults/outputs:
attachmentsDirdefaults to.vitest/attachments/(was.vitest-attachments/), and blob/json/junit/html reporter outputs default to.vitest; acreateReportAPI and.vitestreport directory convention are introduced. - Projects: inline projects extend the root config by default, nested projects are supported, distinct projects share one Vite server, and the config file is no longer looked up from ancestor directories (parent dirs no longer apply).
- Browser: locator objects replace locator strings,
locators.exactis on by default, and ascreenshotDirectoryconfig controlstoMatchScreenshotoutput. - Misc: benchmark public API was rewritten with a pluggable provider API;
-pis a shorthand for--project;-tuses>as separator; coveragethresholds.perFileaccepts an object and TypeScript build mode /vitest liststatic parsing are supported.
Patch Notes (5.0.1 -> 5.0.5)
5.0.2to5.0.5are fixes only — the5.0API surface is unchanged.- The root temp directory is removed when the run closes, and
--changedhandles quoted file names. import.meta.hotstubs exposedata,skipIfsetsskipand ignoresundefinedoptions, and the native loader keeps the import frame inside its errors.- Browser mode: late connections of closed sessions are dropped, global setup runs once with instances, the browser waits up to 30s to close, and synthetic
pagehideevents are ignored. - Hook cleanups run even when a later hook fails, mocks of finished test files are released, and all running tests are aborted on cancel.
- The reporter reports end reason
failedwhen a worker crashes.
Release Highlights (4.1.0 -> 4.1.6)
- New control-flow hooks:
aroundEachandaroundAll. - Test metadata expands with tags,
meta, and improvedtest.extendtype inference. - CLI adds
--detect-async-leaks, richer--updatemodes, and static collection forvitest list. - Browser mode grows Playwright persistent contexts,
userEvent.wheel, and stronger trace/artifact handling. - Mocking/timers add disposable
doMock(),mockThrow/mockThrowOnce, andsetTickMode. 4.1.4adds experimental ARIA snapshots,filterMetafor the JSON reporter, and exposesassertionas a public experimental field.4.1.5adds coverageinstrumentersupport and improves reporter/UI behavior around large snapshots and HTML output.4.1.6tightens browser screenshot path resolution and fixessequence.concurrenthandling for concurrent test scheduling.
Quick Start
Configuration
Or extend Vite config:
Test File Naming
By default, tests must contain .test. or .spec. in filename:
sum.test.jssum.spec.ts__tests__/sum.js
Key Commands
Common Patterns
Basic Test
Mocking
Snapshot Testing
Async Testing
Fake Timers
Jest Migration
Most Jest code works with minimal changes:
Key differences:
- Use
viinstead ofjest - Globals not enabled by default (add
globals: true) vi.mockis hoisted (usevi.doMockfor non-hoisted)- No
jest.requireActual(usevi.importActual)
Environment Selection
TypeScript
References
See references/ directory for detailed documentation on:
- Test API and hooks
- All expect matchers
- Mocking functions and modules
- Configuration options
- CLI commands
- Browser mode testing
Links
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/vitest/SKILL.md
Popularity
- Repository stars
- 15
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 2 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/itechmeat/llm-code/vitest)