Vitest Testing
Structured guide of Vitest patterns covering unit and integration tests, assertions, async handling, and mocking.
- CCM score
- 48 of 100
- skills.sh installs
- 473
- GitHub stars
- 91
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers writing unit and integration tests with
describe,it,expect, and per-test and per-suite hooks - Includes quick references for common assertions, async testing,
vi.fnmocks, and a table of test methods such as.eachand.concurrent - Enforces
awaiton everyexpect(...).resolvesandexpect(...).rejects, and a passing suite run before changes are accepted - Points to separate references for module mocking,
vitest.configand coverage setup, and timers, snapshots, and anti-patterns
Install
$ npx -y skills add existential-birds/beagle --skill vitest-testing -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Vitest Best Practices
Quick Reference
import { describe, it, expect, beforeEach, vi } from 'vitest'
describe('feature name', () => {
beforeEach(() => {
vi.clearAllMocks()
})
it('should do something specific', () => {
expect(actual).toBe(expected)
})
it.todo('planned test')
it.skip('temporarily disabled')
it.only('run only this during dev')
})
Common Assertions
// Equality
expect(value).toBe(42) // Strict (===)
expect(obj).toEqual({ a: 1 }) // Deep equality
expect(obj).toStrictEqual({ a: 1 }) // Strict deep (checks types & undefined keys)
// Numbers & Strings/Arrays
expect(0.1 + 0.2).toBeCloseTo(0.3)
expect(str).toMatch(/pattern/)
expect(array).toContain(item)
expect(array).toHaveLength(3)
// Objects
expect(obj).toHaveProperty('nested.key', 'value')
expect(obj).toMatchObject({ subset: 'of properties' })
// Exceptions
expect(() => fn()).toThrow('error message')
expect(() => fn()).toThrow(/pattern/)
Async Testing
// Async/await (preferred)
it('fetches data', async () => {
const data = await fetchData()
expect(data).toEqual({ id: 1 })
})
Details
- Repository
- github.com/existential-birds/beagle
- Categories
- Testing & QA, Frontend & UI Code
- First seen
- Jun 3, 2026
More from existential-birds/beagle
All 37- Fastapi Code Review396
- React Flow Implementation383
- Shadcn Ui359
- React Flow Code Review330
- Langgraph Architecture283
- Swiftui Code Review277
- Tutorial Docs273
- Bubbletea Code Review271
- Zustand State261
- Dagre React Flow258
- Adr Writing254
- Swift Code Review253
- Pytest Code Review241
- Sqlalchemy Code Review229
- Pydantic Ai Common Pitfalls221
- Agent Architecture Analysis220
- Pydantic Ai Agent Creation219
- Ai Elements211
- Go Code Review206
- Shadcn Code Review206
- Swift Testing Code Review196
- Deepagents Architecture162
- Langgraph Implementation161
- Pydantic Ai Tool System161
Similar to Vitest Testing
More Testing & QAjavascript-testing-patternswshobson/agents21.8K installsComprehensive testing guide covering Jest and Vitest setup, unit, async, and mocking patterns for JavaScript and TypeScript.
vitestpproenca/dot-skills8.4K installsCatalog of 44 Vitest best-practice rules covering async tests, setup, mocking, performance, and snapshots.
python-testing-patternswshobson/agents42.2K installsComprehensive pytest guide covering fixtures, mocking, parameterization, and test-driven development workflows for Python.
vue-testing-best-practicesantfu/skills17.2K installsTesting guide for Vue.js components covering Vitest, Vue Test Utils, mocking, and Playwright E2E tests.
testing-best-practicesasyrafhussin/agent-skills1K installsPractical TDD and unit/integration testing guidelines with 34 TypeScript rules across seven prioritized categories.