vitest

โดย antfu

เฟรมเวิร์กการทดสอบหน่วยความเร็วสูง Vitest ที่ขับเคลื่อนโดย Vite พร้อม API ที่เข้ากันได้กับ Jest ใช้เมื่อเขียนทดสอบ, สร้างม็อก, กำหนดค่าความครอบคลุม, หรือทำงานกับการกรองการทดสอบและฟิกซ์เจอร์

npx skills add https://github.com/antfu/skills --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 5.x (beta), generated at 2026-06-22.

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
Test TagsLabel tests with tags to filter runs and apply shared optionsfeatures-test-tags
ReportersBuilt-in reporters, default selection, CI/output configfeatures-reporters
BenchmarkingWrite benchmarks with the bench fixture (Tinybench)features-benchmarking

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

Skills ที่เกี่ยวข้อง

design-philosophy
microsoft
ปรัชญาการออกแบบของ VS Code — คำศัพท์ร่วมของค่านิยม→หลักการ→การดำเนินการสำหรับการให้เหตุผลเกี่ยวกับ UI ในเชิงออกแบบแทนพิกเซลดิบ ใช้เมื่อออกแบบ…
official
code-explainer
microsoft
อธิบายโค้ดตัวอย่างเป็นภาษาอังกฤษแบบง่ายๆ โดยแยกย่อยว่าส่วนต่างๆ ของโค้ดทำงานอะไรบ้างทีละขั้นตอน เหมาะสำหรับการเรียนรู้ การตรวจสอบโค้ด หรือการจัดทำเอกสาร
official
codegen
vercel
ยูทิลิตี้สำหรับการสร้างโค้ดสำหรับ json-render ใช้เมื่อสร้างโค้ดจากสเปก UI สร้างตัวส่งออกโค้ดแบบกำหนดเอง ตรวจสอบสเปก หรือจัดลำดับพร็อพสำหรับ...
official
apify-actor-development
apify
Develop, debug, and deploy Apify Actors - serverless cloud programs for web scraping, automation, and data processing. Use when creating new Actors, modifying…
official
commits
redis
ปฏิบัติตามรูปแบบ Conventional Commits:
official
pulumi-cdk-to-pulumi
pulumi
โหลดสกิลนี้เมื่อผู้ใช้ต้องการย้าย, แปลง, พอร์ต, แปลภาษา, หรือย้ายแอปพลิเคชัน AWS CDK (รวมถึง CDK stacks, constructs, หรือ...)
official
monitor-pr
microsoft
ตรวจสอบสถานะของ pull request จนกว่าสถานะ CI หรือการตรวจสอบของ Copilot จะพร้อมใช้งาน ใช้เมื่อ: ตรวจสอบ PR, ดู PR, ลง PR, รอ CI, รอการตรวจสอบ, รอการตรวจสอบ,…
official
swiftui-view-refactor
openai
ปรับโครงสร้างและตรวจสอบไฟล์มุมมอง SwiftUI ด้วยค่าเริ่มต้นที่แข็งแกร่งสำหรับมุมมองย่อยเฉพาะขนาดเล็ก การไหลของข้อมูลแบบ MV-over-MVVM ต้นไม้มุมมองที่เสถียร การพึ่งพาที่ชัดเจน…
official