.agents/skills/vitest/SKILL.md
Assists with unit and integration testing using Vitest, a Vite-native test runner. Use when writing tests, configuring mocks, setting up coverage, or migrating from Jest. Trigger words: vitest, unit testing, test runner, vi.fn, vi.mock, test coverage, jest replacement.
npx skillsauth add jaem1n207/synchronize-tab-scrolling vitestInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Vitest is a Vite-native test runner that provides a Jest-compatible API with native ESM support, instant watch mode via Vite's HMR, and shared Vite configuration for aliases, plugins, and transforms. It serves as a drop-in Jest replacement with significantly faster startup and execution.
describe() blocks to group related tests, it() or test() for individual cases, and follow the pattern of naming tests as behavior descriptions (e.g., "should return 404 when user not found").vi.fn() for function mocks, vi.mock("./module") for module mocks, vi.useFakeTimers() for timer control, and vi.setSystemTime() for date mocking.toBe() for primitives, toEqual() for objects/arrays, and toMatchInlineSnapshot() for small expected outputs.vite.config.ts under the test property or in a separate vitest.config.ts, choosing the appropriate environment (jsdom, happy-dom, node).@vitest/coverage-v8 with vitest --coverage and set minimum thresholds in CI with --coverage.thresholds.lines=80.@vitest/browser with Playwright or WebDriverIO providers for real DOM testing instead of jsdom simulation.vitest.workspace.ts for multi-project configuration that shares common settings.User request: "Write Vitest tests for a user service that calls an external API"
Actions:
vi.mock() to intercept API callsdescribe and ittoEqual() and error handling with toThrow()beforeEach with vi.clearAllMocks() for test isolationOutput: Isolated unit tests for the user service with mocked external dependencies.
User request: "Switch our test suite from Jest to Vitest"
Actions:
vitest and add test config to vite.config.tsjest.fn() with vi.fn() and jest.mock() with vi.mock()package.json scripts to use vitest and vitest --coveragets-jest, babel-jest, and Jest config filesOutput: A Vitest-powered test suite with the same tests running faster with native ESM support.
describe blocks to group related tests; keep individual tests focused on one behavior.toEqual() for objects/arrays and toBe() for primitives.beforeEach for test isolation, not beforeAll; shared state between tests causes flaky results.vitest --coverage in CI with a minimum threshold: --coverage.thresholds.lines=80.tools
Build cross-browser extensions with WXT — the modern framework for Chrome, Firefox, Safari, and Edge extensions. Use when someone asks to "build a browser extension", "Chrome extension with React", "WXT framework", "cross- browser extension", "manifest v3 extension", "build Firefox extension", or "browser extension with TypeScript". Covers content scripts, background workers, popup/options pages, storage, messaging, and publishing.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
development
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".
tools
Assists with configuring and using Vite as a frontend build tool for modern web applications. Use when setting up dev servers, optimizing production builds, configuring plugins, migrating from Webpack or CRA, or building component libraries. Trigger words: vite, build tool, HMR, hot module replacement, vite config, rollup, bundling.