
Vitest Testing
A solid reference for Vitest that covers the essentials without the fluff. You get common assertions, async testing patterns with the critical await reminders, and a quick mock reference. The verification gates are actually useful, especially the async matcher check since forgetting await on resolves/rejects creates silent false positives. It splits deeper topics like module mocking and configuration into separate references, which keeps the main doc scannable. Best used when you're writing tests and need to confirm syntax or catch yourself before making the usual mistakes. Not a tutorial, just the patterns you'd otherwise grep the docs for.
- skills.sh installs
- 471
- GitHub stars
- 87
- last updated
- Aug 21, 2026
Install
$ npx -y skills add existential-birds/beagle --skill vitest-testing --agent claude-codeInstalls into .claude/skills of the current project.
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)
// Truthiness
expect(value).toBeTruthy()
expect(value).toBeFalsy()
expect(value).toBeNull()
expect(value).toBeUndefined()
// Numbers
expect(0.1 + 0.2).toBeCloseTo(0.3)
expect(value).toBeGreaterThan(5)
// Strings/Arrays
expect(str).toMatch(/pattern/)
expect(str).toContain('substring')
expect(array).toContain(item)
expect(array).toHaveLength(3)
// Objects
expect(obj).toHaveProperty('key')
expect(obj).toHaveProperty('nested.key', 'value')
expect(obj).toMatchObject({ subset: 'of properties' })
Sponsors
Promote your product hereReach 125k+ visitors monthlyPromote your product hereReach 125k+ visitors monthly
Agent CaffeineSponsoredClose your lid, come back to finished work
SnugSponsoredThe clipboard manager for the AI eraPromote your product hereReach 125k+ visitors monthly
WaxSponsoredBlock anything with supervision, without erasing your iPhonePromote your product hereReach 125k+ visitors monthly
knobsSponsoredSee your site on any phone, any day, in any language
Details
- Repository
- github.com/existential-birds/beagle
- Categories
- Testing & QA, Documentation
- First seen
- Jun 3, 2026
More from existential-birds/beagle
All 40- Docling431
- Fastapi Code Review387
- React Flow Implementation374
- Shadcn Ui356
- React Flow Code Review324
- Langgraph Architecture282
- Swiftui Code Review273
- Tutorial Docs271
- Bubbletea Code Review265
- Zustand State258
- Adr Writing250
- Dagre React Flow247
- Swift Code Review247
- Pytest Code Review232
- Sqlalchemy Code Review225
- Pydantic Ai Common Pitfalls221
- Pydantic Ai Agent Creation219
- Agent Architecture Analysis217
- Ai Elements209
- Go Code Review204
- Shadcn Code Review204
- Swift Testing Code Review194
- Sqlite Vec171
- Pydantic Ai Tool System161
Recommended
More Testing & QA1
umbraco-e2e-testingumbraco/umbraco-cms-backoffice-skillsE2E testing for Umbraco backoffice extensions using Playwright and @umbraco-cms/acceptance-test-helpers380skills.sh installs
2
unit-test-generatorpatricio0312rev/skillsGenerates comprehensive unit tests with AAA pattern (Arrange-Act-Assert), edge cases, error scenarios, and coverage analysis. Creates test files matching source374skills.sh installs
3
cypress-playwright-setuppatricio0312rev/skillsSets up end-to-end testing with Cypress or Playwright including page objects, fixtures, and CI integration. Use when users request "E2E testing", "Cypress setup309skills.sh installs
4
e2e-test-builderpatricio0312rev/skillsBuilds end-to-end browser tests for critical user flows using Playwright or Cypress. Includes selector strategies, test data management, page objects, and visua269skills.sh installs
5
unit-test-bean-validationgiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator. Gener5Kskills.sh installs
6
unit-test-wiremock-rest-apigiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing external REST APIs using WireMock. Stubs API responses, verifies request details, simulates failures (timeouts, 4xx/5xx error3.9Kskills.sh installs