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

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "vitest" with this command: npx skills add onmax/nuxt-skills/onmax-nuxt-skills-vitest

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

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

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

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

Reference Files

TaskFile
Configuration, CLI, projectsconfig.md
test/describe, hooks, fixturestest-api.md
vi.fn, vi.mock, timers, spiesmocking.md
expect, snapshots, coverage, filteringutilities.md
Environments, type testing, browser modeadvanced.md

Loading Files

Consider loading these reference files based on your task:

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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

reka-ui

No summary provided by upstream source.

Repository SourceNeeds Review
2.1K-onmax
General

nuxt

No summary provided by upstream source.

Repository SourceNeeds Review
General

vue

No summary provided by upstream source.

Repository SourceNeeds Review
1.9K-onmax
General

nuxt-ui

No summary provided by upstream source.

Repository SourceNeeds Review
1.6K-onmax