Agent skill

vitest

Use when writing unit/integration tests for Vite projects - configure vitest.config.ts, write test suites with describe/it, create mock implementations with vi.fn and vi.mock, set up code coverage thresholds, and run tests in parallel

Stars 611
Forks 25

Install this agent skill to your Project

npx add-skill https://github.com/onmax/nuxt-skills/tree/main/skills/vitest

SKILL.md

Vitest

Vite-native testing framework with Jest-compatible API.

When to Use

  • Writing unit/integration tests for Vite projects
  • Testing Vue/React/Svelte components
  • Mocking modules, timers, or dates
  • Running concurrent/parallel tests
  • Type testing with TypeScript

Quick Start

bash
npm i -D vitest
ts
// vitest.config.ts
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    globals: true,
    environment: 'node',  // or 'jsdom' for DOM tests
  },
})
ts
// example.test.ts
import { describe, expect, it, vi } from 'vitest'

describe('math', () => {
  it('adds numbers', () => {
    expect(1 + 1).toBe(2)
  })
})

Reference Files

Task File
Configuration, CLI, projects config.md
test/describe, hooks, fixtures test-api.md
vi.fn, vi.mock, timers, spies mocking.md
expect, snapshots, coverage, filtering utilities.md
Environments, type testing, browser mode advanced.md

Loading Files

Consider loading these reference files based on your task:

  • references/config.md - if setting up vitest.config.ts, CLI, or workspace projects
  • references/test-api.md - if writing test/describe blocks, using hooks, or test fixtures
  • references/mocking.md - if mocking modules, timers, dates, or using spies
  • references/utilities.md - if writing assertions, snapshots, or configuring coverage
  • references/advanced.md - if configuring test environments, type testing, or browser mode

DO NOT load all files at once. Load only what's relevant to your current task.

Cross-Skill References

  • Vue component testing → Use vue skill for component patterns
  • Library testing → Use ts-library skill for library patterns
  • Vite configuration → Use vite skill for shared config

Expand your agent's capabilities with these related and highly-rated skills.

onmax/nuxt-skills

pnpm

Use when managing Node.js dependencies with pnpm - install packages, configure monorepo workspaces, set up pnpm catalogs, resolve dependency conflicts with overrides, patch third-party packages, and configure CI pipelines for pnpm projects

611 25
Explore
onmax/nuxt-skills

nuxt-seo

Nuxt SEO meta-module with robots, sitemap, og-image, schema-org. Use when configuring SEO, generating sitemaps, creating OG images, or adding structured data.

611 25
Explore
onmax/nuxt-skills

ts-library

Use when authoring TypeScript libraries or npm packages - covers project setup, package.json exports, build tooling (tsdown/unbuild), API design patterns, type inference tricks, testing, and publishing to npm. Use when bundling, configuring dual CJS/ESM output, or setting up release workflows.

611 25
Explore
onmax/nuxt-skills

motion

Use when adding animations with Motion Vue (motion-v) - provides motion component API, gesture animations, scroll-linked effects, layout transitions, and composables for Vue 3/Nuxt

611 25
Explore
onmax/nuxt-skills

vue

Use when editing .vue files, creating Vue 3 components, writing composables, or testing Vue code - provides Composition API patterns, props/emits best practices, VueUse integration, and reactive destructuring guidance

611 25
Explore
onmax/nuxt-skills

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.

611 25
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results