
Vitest
SkillVitest 5 测试框架的参考:配置、命令行、test / describe / expect API、生命周期钩子,模拟、快照、覆盖率、测试上下文与 fixtures、并发、过滤与标签、报告器、基准测试,以及测试环境、类型测试与多项目配置。由 Anthony Fu 从官方文档生成。
name: vitest
description: 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.
metadata:
author: Anthony Fu
version: "2026.9.25"
source: Generated from https://github.com/vitest-dev/vitest, scripts located at https://github.com/antfu/skills
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:
- Vite-native: Uses Vite's transformation pipeline for fast HMR-like test updates
- Jest-compatible: Drop-in replacement for most Jest test suites
- Smart watch mode: Only reruns affected tests based on module graph
- Native ESM, TypeScript, JSX support without configuration
- Multi-threaded workers for parallel test execution
- Built-in coverage via V8 or Istanbul
- Snapshot testing, mocking, and spy utilities
The skill is based on Vitest 5.0.1, generated at 2026-09-25.
Core
| Topic | Description | Reference |
|---|---|---|
| Configuration | Vitest and Vite config integration, defineConfig usage | core-config |
| CLI | Command line interface, commands and options | core-cli |
| Test API | test/it function, modifiers like skip, only, concurrent | core-test-api |
| Describe API | describe/suite for grouping tests and nested suites | core-describe |
| Expect API | Assertions with toBe, toEqual, matchers and asymmetric matchers | core-expect |
| Hooks | beforeEach, afterEach, beforeAll, afterAll, aroundEach | core-hooks |
Features
| Topic | Description | Reference |
|---|---|---|
| Mocking | Mock functions, modules, timers, dates with vi utilities | features-mocking |
| Snapshots | Snapshot testing with toMatchSnapshot and inline snapshots | features-snapshots |
| Coverage | Code coverage with V8 or Istanbul providers | features-coverage |
| Test Context | Test fixtures, context.expect, test.extend for custom fixtures | features-context |
| Concurrency | Concurrent tests, parallel execution, sharding | features-concurrency |
| Filtering | Filter tests by name, file patterns, tags | features-filtering |
| Test Tags | Label tests with tags to filter runs and apply shared options | features-test-tags |
| Reporters | Built-in reporters, default selection, CI/output config | features-reporters |
| Benchmarking | Write benchmarks with the bench fixture (Tinybench) | features-benchmarking |
Advanced
| Topic | Description | Reference |
|---|---|---|
| Vi Utilities | vi helper: mock, spyOn, fake timers, hoisted, waitFor | advanced-vi |
| Environments | Test environments: node, jsdom, happy-dom, custom | advanced-environments |
| Type Testing | Type-level testing with expectTypeOf and assertType | advanced-type-testing |
| Projects | Multi-project workspaces, different configs per project | advanced-projects |
相關資源

Vite
SkillVite 8 构建工具的参考:vite.config.ts 配置、import.meta.glob 等特性、插件 API、库模式与 SSR、Environment API,以及改用 Rolldown 打包与 Oxc 转译后的迁移要点;偏好 TypeScript 配置与 ESM。由 Anthony Fu 从官方文档生成。
antfu/skills6k
Antfu Conventions
SkillAnthony Fu 对 JavaScript / TypeScript 项目的约定与工具偏好:代码组织、显式导入、Vitest 测试写法,以及 @antfu/ni、开启 antislop 的 @antfu/eslint-config、Knip、tsdown 和统一的 ci 脚本,新建项目时参照 antfu/starter-ts 模板。
antfu/skills6k
Vue Testing Best Practices
SkillVue 测试的最佳实践:推荐 Vitest 与 Vue Test Utils,以黑盒方式测组件,用 flushPromises 处理异步,给出测试组合式函数、Pinia store、异步组件与 Teleport 的方法,不只依赖快照,端到端测试推荐 Playwright。
vuejs-ai/skills2.9k
Diagnosing Bugs
Skill排查疑难缺陷与性能回退的纪律化流程:先构建能稳定复现的反馈回路,再复现与最小化、提出假设、插桩验证,最后修复并补回归测试,输出中要求脱敏密钥。Matt Pocock 出品。
mattpocock/skills294k
Bun
CLI一体化的 JavaScript/TypeScript 工具链:单个 bun 可执行文件同时是 Node.js 兼容运行时、包管理器、测试运行器与脚本运行器,安装依赖与跑测明显更快。
oven-sh/bun96.3k
TDD Guard
Plugin用钩子强制 Claude Code 遵循测试驱动开发:没有失败测试就拦下实现、阻止超出测试的过度实现,可接入 lint 推动重构。需要 Node.js 22+;仍在维护,但作者建议新项目改用后续项目 Probity。
nizos/tdd-guard2.4k