Skills
Skill 13 of 19
Vitest fast unit testing framework powered by Vite with Jest-compatible API.
1 minute · 294 words · 3 sections
Install
npx skills add antfu/skills --skill vitestnpx skills add antfu/skillsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
Vitest is a next-generation testing framework powered by Vite. It provides a Jest-compatible API with native ESM, TypeScript, and JSX support out of the box. Vitest shares the same config, transformers, resolvers, and plugins with your Vite app.
Key Features:
The skill is based on Vitest 5.x (beta), generated at 2026-06-22.
| Topic | Description | Reference |
|---|---|---|
| Configuration | Vitest and Vite config integration, defineConfig usage | core-config (opens in a new tab) |
| CLI | Command line interface, commands and options | core-cli (opens in a new tab) |
| Test API | test/it function, modifiers like skip, only, concurrent | core-test-api (opens in a new tab) |
| Describe API | describe/suite for grouping tests and nested suites | core-describe (opens in a new tab) |
| Expect API | Assertions with toBe, toEqual, matchers and asymmetric matchers | core-expect (opens in a new tab) |
| Hooks | beforeEach, afterEach, beforeAll, afterAll, aroundEach | core-hooks (opens in a new tab) |
| Topic | Description | Reference |
|---|---|---|
| Mocking | Mock functions, modules, timers, dates with vi utilities | features-mocking (opens in a new tab) |
| Snapshots | Snapshot testing with toMatchSnapshot and inline snapshots | features-snapshots (opens in a new tab) |
| Coverage | Code coverage with V8 or Istanbul providers | features-coverage (opens in a new tab) |
| Test Context | Test fixtures, context.expect, test.extend for custom fixtures | features-context (opens in a new tab) |
| Concurrency | Concurrent tests, parallel execution, sharding | features-concurrency (opens in a new tab) |
| Filtering | Filter tests by name, file patterns, tags | features-filtering (opens in a new tab) |
| Test Tags | Label tests with tags to filter runs and apply shared options | features-test-tags (opens in a new tab) |
| Reporters | Built-in reporters, default selection, CI/output config | features-reporters (opens in a new tab) |
| Benchmarking | Write benchmarks with the bench fixture (Tinybench) | features-benchmarking (opens in a new tab) |
| Topic | Description | Reference |
|---|---|---|
| Vi Utilities | vi helper: mock, spyOn, fake timers, hoisted, waitFor | advanced-vi (opens in a new tab) |
| Environments | Test environments: node, jsdom, happy-dom, custom | advanced-environments (opens in a new tab) |
| Type Testing | Type-level testing with expectTypeOf and assertType | advanced-type-testing (opens in a new tab) |
| Projects | Multi-project workspaces, different configs per project | advanced-projects (opens in a new tab) |
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 23 June 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md./antfu/skills.md, and each skill at its own .md URL.20 files · 91 KB
Everything this skill ships beside its prose. All of it is set here, as subchapters of skill 13.
Documentation the agent loads on demand, rather than up front.
Everything else published alongside the skill.