MCPInstall

vitest

Provides comprehensive guidance for Vitest testing framework including fast test execution, Vite integration, component testing, mocking, and configuration. Use when the user asks about Vitest, needs to write fast unit tests, test Vue/React components, or configure Vitest with Vite projects.

Installs
87
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/full-stack-skills/testing-skills --skill vitest
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads vitest automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

When to use this skill

Use this skill whenever the user wants to:

  • Set up Vitest in a Vite project
  • Write unit tests and component tests
  • Configure Vitest for different environments
  • Use Vitest API and utilities
  • Test Vue, React, or Svelte components
  • Use browser mode for testing
  • Set up visual regression testing
  • Mock functions and modules
  • Use snapshots for testing
  • Configure test coverage
  • Use Vitest UI
  • Optimize test performance
  • Debug tests
  • Understand Vitest best practices
  • Troubleshoot Vitest issues

How to use this skill

This skill is organized to match the Vitest official documentation structure (https://vitest.dev/guide/, https://vitest.dev/api/, https://vitest.dev/config/). When working with Vitest:

  1. Identify the topic from the user's request:

    • Getting started/快速开始 → examples/getting-started.md
    • Features/功能特性 → examples/features.md
    • Component testing/组件测试 → examples/component-testing.md
    • Browser mode/浏览器模式 → examples/browser-mode.md
    • API/API 文档 → api/
    • Configuration/配置 → examples/config/
  2. Load the appropriate example file from the examples/ directory:

    Getting Started (快速开始):

    • examples/getting-started.md - Installation and first test

    Features (功能特性):

    • examples/features.md - Key features and capabilities
    • examples/ui.md - Vitest UI
    • examples/component-testing.md - Component testing
    • examples/browser-mode.md - Browser mode testing
    • examples/visual-regression-testing.md - Visual regression testing
    • examples/trace-view.md - Trace view

    Testing (测试):

    • examples/test-api.md - Test API (test, it, describe, etc.)
    • examples/mocking.md - Mocking functions and modules
    • examples/snapshots.md - Snapshot testing
    • examples/coverage.md - Code coverage

    Configuration (配置):

    • examples/config/basic-config.md - Basic configuration
    • examples/config/environment.md - Environment configuration
    • examples/config/browser-config.md - Browser mode configuration
  3. Follow the specific instructions in that example file for syntax, structure, and best practices

    Important Notes:

    • Vitest is designed for Vite projects
    • Supports TypeScript, JSX, ESM out of the box
    • Fast watch mode with HMR-like experience
    • Compatible with Jest API
    • Examples include both JavaScript and TypeScript versions
    • Each example file includes key concepts, code examples, and key points
  4. Reference API documentation in the api/ directory when needed:

    • api/test-api.md - Test API reference
    • api/vi-utility.md - vi utility functions
    • api/expect.md - Expect assertions
    • api/mocking.md - Mocking API
  5. Use templates from the templates/ directory:

    • templates/vitest-config.md - Vitest configuration templates
    • templates/test-examples.md - Test example templates

Doc mapping (one-to-one with https://vitest.dev/guide/, https://vitest.dev/api/, https://vitest.dev/config/)

Guide (指南):

Configuration (配置):

API Reference:

Examples and Templates

This skill includes detailed examples organized to match the official documentation structure. All examples are in the examples/ directory (see mapping above).

To use examples:

  • Identify the topic from the user's request
  • Load the appropriate example file from the mapping above
  • Follow the instructions, syntax, and best practices in that file
  • Adapt the code examples to your specific use case

To use templates:

  • Reference templates in templates/ directory for common scaffolding
  • Adapt templates to your specific needs and coding style

Best Practices

  1. Use watch mode: Leverage Vitest's smart watch mode for faster feedback
  2. Organize tests: Group related tests with describe blocks
  3. Use TypeScript: Take advantage of native TypeScript support
  4. Mock effectively: Use vi.mock() for module mocking
  5. Test components: Use component testing for Vue/React components
  6. Use UI mode: Use --ui flag for better test debugging experience
  7. Optimize performance: Use test.only() during development

Resources

Keywords

Vitest, vitest, test framework, unit testing, component testing, Vite, Jest compatible, watch mode, HMR, TypeScript, ESM, mocking, snapshots, coverage, browser mode, visual regression testing, 测试框架, 单元测试, 组件测试, 监视模式, 热模块替换, 模拟, 快照, 覆盖率, 浏览器模式, 视觉回归测试

FAQ

What does the vitest skill do?

Provides comprehensive guidance for Vitest testing framework including fast test execution, Vite integration, component testing, mocking, and configuration. Use when the user asks about Vitest, needs to write fast unit tests, test Vue/React components, or configure Vitest with Vite projects.

How do I install vitest?

Run npx skills add https://github.com/full-stack-skills/testing-skills --skill vitest in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/vitest/ (personal) or .claude/skills/vitest/ (project).

Which AI agents can use vitest?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is vitest safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains vitest?

It is published by full-stack-skills in full-stack-skills/testing-skills. It has 87 recorded installs.

More from full-stack-skills/testing-skills

View all →

playwright

full-stack-skills/testing-skills

Provides comprehensive guidance for Playwright testing including browser automation, test writing, page objects, and cross-browser testing. Use when the user asks about Playwright, needs to write E2E tests, automate browsers, or test web applications across browsers.

Testing & QA88 installs

pytest

full-stack-skills/testing-skills

Provides comprehensive guidance for pytest testing framework including test writing, fixtures, parametrization, mocking, and plugins. Use when the user asks about pytest, needs to write Python tests, use pytest fixtures, or configure pytest for Python projects.

Testing & QA78 installs

jest

full-stack-skills/testing-skills

Open the skill to read its SKILL.md instructions.

Testing & QA71 installs

appium

full-stack-skills/testing-skills

Provides comprehensive guidance for Appium mobile testing including mobile app automation, element location, gestures, and cross-platform testing. Use when the user asks about Appium, needs to test mobile applications, automate mobile apps, or write Appium test scripts.

Testing & QA66 installs

junit

full-stack-skills/testing-skills

Provides comprehensive guidance for JUnit testing framework including test annotations, assertions, test lifecycle, and best practices. Use when the user asks about JUnit, needs to write Java unit tests, use JUnit annotations, or configure JUnit for Java projects.

Testing & QA66 installs

selenium

full-stack-skills/testing-skills

Provides comprehensive guidance for Selenium WebDriver including browser automation, element location, waits, and test frameworks. Use when the user asks about Selenium, needs to automate web browsers, write Selenium tests, or work with Selenium WebDriver.

Testing & QA64 installs

Popular testing & qa skills

View category →

tdd

mattpocock/skills

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

Testing & QA1.2M installs

grilling

mattpocock/skills

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

Testing & QA996.2K installs

migrate-to-shoehorn

mattpocock/skills

Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.

Testing & QA484.1K installs

run-train

lllllllama/rigorpilot-skills

Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.

Testing & QA337.8K installs

test-driven-development

obra/superpowers

Use when implementing any feature or bugfix, before writing implementation code

Testing & QA261.8K installs

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

Testing & QA216.8K installs