Vitest Testing Guide
Writing fast, maintainable unit tests:
- Colocate test files alongside source code (
*.test.ts). - Use
vi.mock()with type-safe factories. - Reset mocks between tests with
vi.restoreAllMocks().
Write blazingly fast unit and integration tests with Vitest, ESM support, mock timers, and coverage reporting.
Andromity loads skills from folders you trust. Install with andromity skill install vitest-unit-testing — autonomy and approval limits stay configurable per session.
# Install the "Vitest Fast Unit Testing" skill You are installing an AgenticMarket skill into this workspace. Follow these steps exactly. ## 1. Detect your environment and choose the destination file - Andromity: `.andromity/skills/vitest-unit-testing/SKILL.md` (or user scope `~/.andromity/skills/vitest-unit-testing/SKILL.md`) - Antigravity / Gemini CLI: `.agent/skills/vitest-unit-testing/SKILL.md` - Cursor: `.cursor/rules/vitest-unit-testing.mdc` - Claude Code: append to `CLAUDE.md` (or `.claude/skills/vitest-unit-testing.md`) - Windsurf: append to `.windsurfrules` - Cline / Roo Code: `.clinerules/vitest-unit-testing.md` - GitHub Copilot: append to `.github/copilot-instructions.md` - ChatGPT / web only: paste the content into Custom Instructions - Any other agent: save to `.agent/skills/vitest-unit-testing/SKILL.md` ## 2. Create the destination file - Preserve every existing file and configuration entry. - Create parent folders as needed. - Never overwrite unrelated content. ## 3. Write exactly this content ```markdown --- name: vitest-unit-testing description: "Write blazingly fast unit and integration tests with Vitest, ESM support, mock timers, and coverage reporting." author: community license: mit version: 1.0.0 --- # Vitest Testing Guide Writing fast, maintainable unit tests: - Colocate test files alongside source code (`*.test.ts`). - Use `vi.mock()` with type-safe factories. - Reset mocks between tests with `vi.restoreAllMocks()`. ``` ## 4. Verify - Confirm the file exists and is readable. - Report the destination path and confirm the "Vitest Fast Unit Testing" skill is installed and active. Skill metadata: - Slug: vitest-unit-testing - Category: testing - License: mit - Source: AgenticMarket
Writing fast, maintainable unit tests:
*.test.ts).vi.mock() with type-safe factories.vi.restoreAllMocks().End-to-end browser automation, Page Object Model (POM), trace recording, and cross-browser visual regression testing.
Interactive component testing, real-browser debugging, network stubbing, and custom Cypress commands.
Measure, diagnose, and optimize Core Web Vitals (LCP, INP, CLS), render-blocking resources, and Lighthouse scores.