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.1.0-beta.1, generated at 2026-10-23.

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 ที่เกี่ยวข้อง

expo-upgrade
expo
เฟรมเวิร์ก (โอเพนซอร์ส) แนวทางการอัปเกรดเวอร์ชัน Expo SDK และแก้ไขปัญหาการพึ่งพา
apidevelopmenttesting
ui-sdk
vercel
สร้างอินเทอร์เฟซด้วย ui-sdk ใน React, Vue, Svelte, Solid หรือ web components ครอบคลุมการเลือกและประกอบคอมโพเนนต์ การสร้างคอมโพเนนต์หรือพฤติกรรมที่ไม่มีมาให้ใน @ui-sdk/core (เช่น stepper, splitter, transfer list หรือ emoji picker) การทำให้อินเทอร์เฟซใช้งานได้โดยเอเจนต์ผ่าน createAgent, เครื่องมือของเอเจนต์ และ WebMCP ตลอดจนการทดสอบแป้นพิมพ์ โฟกัส ARIA การเรนเดอร์ฝั่งเซิร์ฟเวอร์ และการจัดวางข้อความจากขวาไปซ้าย รวมถึงการเขียนการทดสอบสำหรับคอมโพเนนต์ที่มีอยู่แล้ว ใช้เมื่อใดก็ตามที่โปรเจกต์มี @ui-sdk/*...
testingdesigndevelopment
workers-development
cloudflare
เรียกใช้ ตรวจสอบ และดีบัก Cloudflare Workers ระหว่างการพัฒนาในเครื่องด้วย cf dev, wrangler dev หรือ Cloudflare Vite plugin โดยใช้ Local Explorer เพื่ออ่านและป้อนข้อมูลให้ binding รวมถึงค้นหา traces และ logs ในเครื่อง นอกจากนี้ยังส่งต่อการดีบักใน production ไปยัง Workers observability ใช้สำหรับดีบักคำขอ ไม่ว่าโปรเจกต์จะใช้ Wrangler หรือไม่ก็ตาม
devopstestingdevelopment
workers-profiling
cloudflare
วิเคราะห์โปรไฟล์หรือดีบักการใช้งาน CPU และการจัดสรรหน่วยความจำใน Cloudflare Workers และ Durable Objects ที่นำไปใช้งานแล้ว จากนั้นใช้ข้อมูลนี้เพื่อปรับโค้ดให้เหมาะสมยิ่งขึ้น
devopstestingdevelopment
accessibility
addyosmani
ตรวจสอบและปรับปรุงการเข้าถึงเว็บตามแนวทาง WCAG 2.2 ใช้เมื่อถูกขอให้ "ปรับปรุงการเข้าถึง", "ตรวจสอบ a11y", "ปฏิบัติตาม WCAG", "รองรับโปรแกรมอ่านหน้าจอ", "การนำทางด้วยแป้นพิมพ์" หรือ "ทำให้เข้าถึงได้
developmenttestingcode-review
accessibility-engineering
addyosmani
ตรวจสอบอินเทอร์เฟซที่มีอยู่แล้วว่าตรงตาม WCAG 2.2 AA หรือไม่ และแก้ไขการละเมิดที่พบ ใช้เมื่อตรวจสอบการเข้าถึงของหน้าเว็บหรือคอมโพเนนต์ เรียกใช้ axe-core หรือ pa11y จัดลำดับความสำคัญของการละเมิดด้าน a11y หรือตรวจสอบปัญหาเกี่ยวกับโปรแกรมอ่านหน้าจอและคอนทราสต์ก่อนเผยแพร่
developmenttestingdesign
audit-website
squirrelscan
ตรวจสอบเว็บไซต์ด้วย squirrelscan CLI และแก้ไขข้อค้นพบในโค้ด ทำงานกับกฎหมวดหมู่ SEO, ประสิทธิภาพ, ความปลอดภัย, เทคนิค, เนื้อหา, การเข้าถึง และอีก 15 หมวดหมู่ (มากกว่า 249 กฎ) ส่งคืนรายงานที่ปรับให้เหมาะสมกับ LLM จากนั้นขับเคลื่อนลูปการแก้ไขแบบวนซ้ำ โดยจับคู่ปัญหากับไฟล์ต้นทาง ใช้การแก้ไข และตรวจสอบซ้ำจนกว่าเว็บไซต์จะได้คะแนนดี ใช้เพื่อค้นหาและประเมินปัญหาเว็บไซต์หรือเว็บแอป และขับเคลื่อนให้แก้ไขจนเสร็จ
developmenttestingweb-scraping
better-accessibility
jakubkrehel
ตรวจสอบและแก้ไขการทำงานของแป้นพิมพ์และโฟกัส, ARIA, ชื่อที่เข้าถึงได้, แบบฟอร์ม, การประกาศสำหรับโปรแกรมอ่านหน้าจอ, การเคลื่อนไหว และการซูม ให้เป็นไปตาม WCAG 2.2
developmenttestingcode-review