or run

tessl search
Log in

vitest

tessl install github:onmax/nuxt-skills --skill vitest

github.com/onmax/nuxt-skills

A blazing fast unit testing framework powered by Vite

Review Score

73%

Validation Score

12/16

Implementation Score

100%

Activation Score

22%

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

Load Based on Task

Setting up tests? → Load config.md Writing test cases? → Load test-api.md Mocking dependencies? → Load mocking.md Assertions/snapshots? → Load utilities.md DOM/browser/types? → Load advanced.md

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