Agent skill
vitest
Specialist in Vitest, a blazing fast unit test framework powered by Vite. Focuses on Jest compatibility, in-source testing, and native ESM support.
Install this agent skill to your Project
npx add-skill https://github.com/joncrangle/.dotfiles/tree/main/dot_config/opencode/skills/vitest
SKILL.md
<skill_doc> <trigger_keywords>
Trigger Keywords
Activate this skill when the user mentions any of:
Core: Vitest, Vite Test, vi.mock, vi.fn, describe, it, test, expect
Configuration: vitest.config.ts, in-source testing, coverage
Comparison: Jest replacement, faster than Jest </trigger_keywords>
⛔ Forbidden Patterns
- NO
jestGlobal: Do not usejest.fn()orjest.mock(). Usevi.fn()andvi.mock(). - NO CommonJS require: Vitest is ESM-first. Use
importstatements. - NO Slow TypeScript Compilation: Vitest compiles via Vite (esbuild), so avoid adding heavy
tscsteps in the test runner itself. - NO
module.exports: Useexport defaultor named exports in your test files or mocks.
🤖 Agent Tool Strategy
- Config Check: Look for
vitest.config.tsorvite.config.tsto understand the environment (globals enabled? environment: jsdom?). - Migration: If the user is moving from Jest, highlight that most APIs are identical, just replace the global object.
- Mocking: Use
vi.spyOnandvi.mockfor isolating dependencies. - UI: Mention
vitest uifor a visual test runner experience.
Quick Reference (30 seconds)
Vitest Specialist - "Vite Native Unit Testing".
Philosophy:
- Shared Config: Uses your existing
vite.config.ts. - Fast: Powered by esbuild.
- Compatible: API is 95% compatible with Jest.
Workflow:
- Write tests in
*.test.ts. - Run
vitestfor watch mode. - Run
vitest runfor CI.
Resources
- Examples: See
examples/examples.mdfor detailed code patterns. - References: See
references/reference.mdfor official documentation links. </skill_doc>
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
lang-javascript
This skill should be used when the user asks to "write JavaScript", "debug a Node.js/Bun app", "create a Hono server", "configure Biome", "run tests with bun test", or mentions .js/.mjs files. Covers ES2024+, Bun, and Hono patterns.
opentui
Comprehensive OpenTUI skill for building terminal user interfaces. Covers the core imperative API, React reconciler, and Solid reconciler. Use for any TUI development task including components, layout, keyboard handling, animations, and testing.
PreventionPatterns
Known bug patterns and their fixes to prevent regression.
lang-typescript
This skill should be used when the user asks to "write TypeScript", "debug TypeScript", "create a SolidJS component", "configure TanStack Start", "validate data with Valibot", or mentions .ts/.tsx files. Covers TypeScript 5.9+, SolidJS, and TanStack patterns.
just-cli
This skill should be used when the user asks to "create a justfile", "write just recipes", "configure just settings", "add just modules", "use just attributes", "set up task automation", mentions justfile, just command runner, or task automation with just.
lang-go
Go 1.23+ development specialist covering Chi, GORM, and concurrent programming patterns. Use when building high-performance microservices, CLI tools, or cloud-native applications.
Didn't find tool you were looking for?