vitest
Use when writing unit/integration tests for Vite projects - configure vitest.config.ts, write test suites with describe/it, create mock implementations with vi.fn and vi.mock, set up code coverage thresholds, and run tests in parallel
How do I install this agent skill?
npx skills add https://github.com/onmax/nuxt-skills --skill vitestIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides comprehensive documentation for Vitest, a testing framework. It includes configuration examples, API references, and mocking patterns. No security issues were detected, and all external references target well-known, trusted packages.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerpass
1/6 files flagged
- ZeroLeakspass
Score: 93/100 · 2 sections analyzed
What does this agent skill do?
Vitest
Vite-native testing framework with Jest-compatible API.
When to Use
- Writing unit/integration tests for Vite projects
- Testing Vue/React/Svelte components
- Mocking modules, timers, or dates
- Running concurrent/parallel tests
- Type testing with TypeScript
Quick Start
npm i -D vitest
// vitest.config.ts
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
globals: true,
environment: 'node', // or 'jsdom' for DOM tests
},
})
// example.test.ts
import { describe, expect, it, vi } from 'vitest'
describe('math', () => {
it('adds numbers', () => {
expect(1 + 1).toBe(2)
})
})
Reference Files
| Task | File |
|---|---|
| Configuration, CLI, projects | config.md |
| test/describe, hooks, fixtures | test-api.md |
| vi.fn, vi.mock, timers, spies | mocking.md |
| expect, snapshots, coverage, filtering | utilities.md |
| Environments, type testing, browser mode | advanced.md |
Loading Files
Consider loading these reference files based on your task:
- references/config.md - if setting up vitest.config.ts, CLI, or workspace projects
- references/test-api.md - if writing test/describe blocks, using hooks, or test fixtures
- references/mocking.md - if mocking modules, timers, dates, or using spies
- references/utilities.md - if writing assertions, snapshots, or configuring coverage
- references/advanced.md - if configuring test environments, type testing, or browser mode
DO NOT load all files at once. Load only what's relevant to your current task.
Cross-Skill References
- Vue component testing → Use
vueskill for component patterns - Library testing → Use
ts-libraryskill for library patterns - Vite configuration → Use
viteskill for shared config
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/onmax/nuxt-skills/vitest">View vitest on skillZs</a>