Community코딩 & 개발github.com

antfu/vitest

Vite 기반의 빠른 단위 테스트 프레임워크로 Jest 호환 API를 제공합니다. 테스트 작성, 모킹(mocking), 커버리지 구성, 테스트 필터링 및 픽스처(fixture) 작업 시 사용합니다.

vitest란 무엇인가요?

이 스킬은 Vite 기반의 초고속 단위 테스트 프레임워크인 Vitest를 활용하기 위한 것입니다. Jest 호환 API를 제공하여 Jest 사용자가 손쉽게 전환할 수 있으며, Vite의 빠른 HMR 및 플러그인 생태계를 그대로 사용할 수 있습니다. Vitest는 기본적으로 테스트 필터링, 모킹, 코드 커버리지, 픽스처, 스냅샷 테스트 등 현대적인 테스트 기능을 내장하고 있어 별도의 설정 없이도 강력한 테스트 환경을 구축할 수 있습니다. Claude Code, Cursor, Codex 등 다양한 AI 에이전트 플랫폼에서 이 스킬을 사용하면 개발자가 테스트를 작성하거나 실행할 때 AI가 문맥을 이해하고 적절한 명령어와 설정을 추천해 줍니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/antfu/skills/tree/main/skills/vitest

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

vitest은(는) 무엇을 하나요?

Vitest는 Vite로 구동되는 빠른 단위 테스트 프레임워크로, Jest 호환 API를 제공합니다. 테스트 작성, 모킹, 커버리지 구성, 테스트 필터링 및 픽스처 작업에 사용합니다.

설치

npm install -D vitest

기본 사용법

vitest.config.ts 파일을 프로젝트 루트에 생성합니다:

import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    // 테스트 옵션
  },
})

다음 명령어로 테스트를 실행합니다:

npx vitest

주요 기능

  • Jest 호환 API: describe, it, expect, beforeEach, afterEach 등을 그대로 사용할 수 있습니다.
  • 모킹: vi.mock(), vi.spyOn() 등 강력한 모킹 기능을 제공합니다.
  • 커버리지: c8 또는 istanbul을 사용한 코드 커버리지 보고서를 지원합니다.
  • 테스트 필터링: --grep, --inspect 옵션으로 특정 테스트만 실행할 수 있습니다.
  • 픽스처: vi.stubGlobal(), vi.unstubAllGlobals() 등 전역 상태를 쉽게 관리할 수 있습니다.

환경 변수

  • VITEST: Vitest가 실행 중임을 나타내는 환경 변수입니다.
  • NODE_ENV: 기본적으로 test로 설정됩니다.

추가 문서

자세한 내용은 Vitest 공식 문서를 참조하세요.

Individual skills in this repo

This repo contains 16 individual skills — each has its own dedicated page.

antfu/antfu

Anthony Fu's opinionated tooling and conventions for JavaScript/TypeScript projects. Use when setting up new projects, configuring ESLint/Prettier alternatives, monorepos, library publishing, or when the user mentions Anthony Fu's preferences.

antfu/nuxt

Nuxt full-stack Vue framework with SSR, auto-imports, and file-based routing. Use when working with Nuxt apps, server routes, useFetch, middleware, or hybrid rendering.

antfu/pinia

Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.

antfu/pnpm

Node.js package manager with strict dependency resolution. Use when running pnpm specific commands, configuring workspaces, or managing dependencies with catalogs, patches, or overrides.

antfu/slidev

Create and present web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, and interactive features. Use when building technical presentations, conference talks, code walkthroughs, teaching materials, or developer decks.

antfu/tsdown

Bundle TypeScript and JavaScript libraries with blazing-fast speed powered by Rolldown. Use when building libraries, generating type declarations, bundling for multiple formats, or migrating from tsup.

antfu/turborepo

Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines, dependsOn, caching, remote cache, the "turbo" CLI, --filter, --affected, CI optimization, environment variables, internal packages, monorepo structure/best practices, and boundaries. Use when user: configures tasks/workflows/pipelines, creates packages, sets up monorepo, shares code between apps, runs changed/affected packages, debugs cache, or has apps/packages directories.

antfu/unocss

UnoCSS instant atomic CSS engine, superset of Tailwind CSS. Use when configuring UnoCSS, writing utility rules, shortcuts, or working with presets like Wind, Icons, Attributify.

antfu/vite

Vite build tool configuration, plugin API, SSR, and Vite 8 Rolldown migration. Use when working with Vite projects, vite.config.ts, Vite plugins, or building libraries/SSR apps with Vite.

antfu/vitepress

VitePress static site generator powered by Vite and Vue. Use when building documentation sites, configuring themes, or writing Markdown with Vue components.

antfu/vue

Vue 3 Composition API, script setup macros, reactivity system, and built-in components. Use when writing Vue SFCs, defineProps/defineEmits/defineModel, watchers, or using Transition/Teleport/Suspense/KeepAlive.

antfu/vue-best-practices

MUST be used for Vue.js tasks. Strongly recommends Composition API with `<script setup>` and TypeScript as the standard approach. Covers Vue 3, SSR, Volar, vue-tsc. Load for any Vue, .vue files, Vue Router, Pinia, or Vite with Vue work. ALWAYS use Composition API unless the project explicitly requires Options API.

antfu/vue-router-best-practices

Vue Router 4 patterns, navigation guards, route params, and route-component lifecycle interactions.

antfu/vue-testing-best-practices

Use for Vue.js testing. Covers Vitest, Vue Test Utils, component testing, mocking, testing patterns, and Playwright for E2E testing.

antfu/vueuse-functions

Apply VueUse composables where appropriate to build concise, maintainable Vue.js / Nuxt features.

antfu/web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

관련 스킬