vitest
하는 일
이 스킬은 Vite 프로젝트와 함께 작동하는 테스트 도구 Vitest로 자동 테스트를 작성하고 실행하는 방법을 설명합니다. Jest와 비슷한 방식으로 빠른 테스트를 원하는 개발자를 위한 것입니다.
사용하는 경우
- ✓함수나 컴포넌트의 단위 테스트를 작성해야 할 때.
- ✓모의(mock) 객체, 스파이, 스냅샷 테스트를 추가하고 싶을 때.
- ✓테스트 커버리지를 설정하거나 실행할 테스트를 고르고 싶을 때.
스킬 링크
https://github.com/antfu/skills/blob/main/skills/vitest/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 가격 계산 함수에 대한 Vitest 단위 테스트를 경계 사례까지 포함해서 작성해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 Vitest의 test, describe, expect 함수를 사용하고 프로젝트 설정을 따릅니다. 감시 모드에서는 변경의 영향을 받는 테스트만 다시 실행합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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
| 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 |
자주 묻는 질문
Vitest는 Jest와 같은가요?
비슷합니다. API가 대부분의 Jest 테스트 모음과 호환되어, 많은 테스트를 쉽게 옮길 수 있습니다.
테스트 커버리지를 측정할 수 있나요?
네. V8 또는 Istanbul로 커버리지를 수집할 수 있습니다.
TypeScript에 추가 설정이 필요한가요?
아니요. TypeScript, ES 모듈, JSX는 추가 설정 없이 작동합니다.
상세 정보
작성자의 원본 설명
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.
repo: antfu/skills
인기도
- GitHub 스타
- 6.0k
- 순위
- #14447
- 라이선스
- MIT
- 업데이트
- 2026. 10. 30.
댓글
- …
이 저장소의 다른 스킬
antfu-create-pr
6.0k에이전트가 내 브랜치에서 GitHub 풀 리퀘스트를 열도록 돕고, 무엇이 왜 바뀌었는지 쉽게 설명한 요약을 함께 씁니다.
antfu-issue-triage
6.0k에이전트가 열린 GitHub 이슈와 풀 리퀘스트를 살펴 중복과 이미 해결된 항목을 찾고, 실행 전에 사용자에게 먼저 묻도록 돕습니다.
antfu-query
6.0k에이전트가 계획을 한 번에 한 단계씩 질문해, 함께 명확하고 검증된 이해에 이르도록 돕습니다.
antfu-simplify
6.0k에이전트가 코드 변경을 필요 없는 부분을 빼고 가장 작고 올바른 형태로 줄이도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.