본문으로 건너뛰기
Skillpedia
테스트6.0k · #14447

vitest

하는 일

이 스킬은 Vite 프로젝트와 함께 작동하는 테스트 도구 Vitest로 자동 테스트를 작성하고 실행하는 방법을 설명합니다. Jest와 비슷한 방식으로 빠른 테스트를 원하는 개발자를 위한 것입니다.

사용하는 경우

  • ✓함수나 컴포넌트의 단위 테스트를 작성해야 할 때.
  • ✓모의(mock) 객체, 스파이, 스냅샷 테스트를 추가하고 싶을 때.
  • ✓테스트 커버리지를 설정하거나 실행할 테스트를 고르고 싶을 때.

스킬 링크

https://github.com/antfu/skills/blob/main/skills/vitest/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/antfu/skills/blob/main/skills/vitest/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬