vitest

作者: supabase

由 Vite 驱动的快速单元测试框架,兼容 Jest API。在编写测试、模拟、配置覆盖率或处理测试时使用。

npx skills add https://github.com/supabase/supabase --skill vitest

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 3.x, generated at 2026-01-28.

Core

TopicDescriptionReference
ConfigurationVitest and Vite config integration, defineConfig usagecore-config
CLICommand line interface, commands and optionscore-cli
Test APItest/it function, modifiers like skip, only, concurrentcore-test-api
Describe APIdescribe/suite for grouping tests and nested suitescore-describe
Expect APIAssertions with toBe, toEqual, matchers and asymmetric matcherscore-expect
HooksbeforeEach, afterEach, beforeAll, afterAll, aroundEachcore-hooks

Features

TopicDescriptionReference
MockingMock functions, modules, timers, dates with vi utilitiesfeatures-mocking
SnapshotsSnapshot testing with toMatchSnapshot and inline snapshotsfeatures-snapshots
CoverageCode coverage with V8 or Istanbul providersfeatures-coverage
Test ContextTest fixtures, context.expect, test.extend for custom fixturesfeatures-context
ConcurrencyConcurrent tests, parallel execution, shardingfeatures-concurrency
FilteringFilter tests by name, file patterns, tagsfeatures-filtering

Advanced

TopicDescriptionReference
Vi Utilitiesvi helper: mock, spyOn, fake timers, hoisted, waitForadvanced-vi
EnvironmentsTest environments: node, jsdom, happy-dom, customadvanced-environments
Type TestingType-level testing with expectTypeOf and assertTypeadvanced-type-testing
ProjectsMulti-project workspaces, different configs per projectadvanced-projects

来自 supabase 的更多技能

studio-e2e-tests
supabase
编写并运行Supabase Studio的Playwright端到端测试。在收到相关请求时使用。
official
skill-creator
supabase
创建模块化技能的全面指南,用于扩展Claude的能力,涵盖专业知识和工作流程。技能包含必需的SKILL.md文件(含YAML前置元数据和Markdown指令),以及按用途组织、渐进加载以节省上下文的可选捆绑资源(脚本、参考资料、素材)。围绕具体使用案例设计技能;为确定性任务识别可复用脚本,为领域知识准备参考文件,为...提供素材。
official
supabase
supabase
在执行任何涉及Supabase的任务时使用。触发条件:Supabase产品(数据库、认证、边缘函数、实时功能、存储、向量、定时任务、队列);客户端…
official
supabase-server
supabase
在编写使用Supabase的服务器端代码时使用——包括Edge Functions、Hono应用、Webhook处理器或任何需要Supabase认证和客户端创建的后端。
official
clickhouse-logs-queries
supabase
Write, review, and migrate Supabase logs queries against the ClickHouse-backed `logs` table (the `logs.all.otel` analytics endpoint). Use this whenever a task…
official
dev-toolbar-review
supabase
在审查涉及 packages/dev-tools/、packages/common/posthog-client.ts 的 PR 时使用
official
e2e-studio-tests
supabase
在Studio应用中运行端到端测试。当被要求运行端到端测试、运行Studio测试、Playwright测试或测试功能时使用。
official
safe-sql-execution
supabase
Safely execute SQL queries against a user database without risking SQL injection or other security vulnerabilities.
official