vitest-best-practices

Solid

Comprehensive vitest testing patterns covering test structure, AAA pattern, parameterized tests, assertions, mocking, test doubles, error handling, async testing, and performance optimization. Use when writing, reviewing, or refactoring vitest tests, or when user mentions vitest, testing, TDD, test coverage, mocking, assertions, or test files (*.test.ts, *.spec.ts).

Testing & QA 244 stars 35 forks Updated today MIT

Install

View on GitHub

Quality Score: 92/100

Stars 20%
80
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Vitest Best Practices ## When to Apply This Skill Use this skill when you encounter any of these scenarios: ### File Patterns - Working with `*.test.ts`, `*.spec.ts`, or similar test files - Creating new test files for TypeScript/JavaScript modules - Reviewing existing vitest test suites ### User Intent Keywords - User mentions: vitest, testing, TDD, BDD, unit tests, integration tests - User asks to: write tests, add test coverage, fix failing tests, refactor tests - User discusses: mocking, stubbing, assertions, test performance, test organization ### Code Context - Files importing from `vitest` (`describe`, `it`, `expect`, `vi`) - Test setup/teardown code (`beforeEach`, `afterEach`, `beforeAll`, `afterAll`) - Mock/spy implementations using `vi.mock()`, `vi.spyOn()`, `vi.fn()` - Assertion chains (`expect(...).toEqual()`, `.toBe()`, `.toThrow()`, etc.) ### Common Tasks - Writing new test cases for existing functionality - Refactoring tests for better clarity or performance - Debugging flaky or failing tests - Improving test coverage or maintainability - Reviewing test code for best practices compliance ## Do NOT Use This Skill When - Writing end-to-end tests with Playwright/Cypress (different scope) - The task is purely about implementation code, not tests ## What This Skill Covers This skill provides comprehensive guidance on: 1. **Test Organization**: File placement, naming conventions, grouping strategies 2. **AAA Pattern**: Arrange, Act, Assert structure ...

Details

Author
PageAI-Pro
Repository
PageAI-Pro/ralph-loop
Created
4 months ago
Last Updated
today
Language
Shell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Listed

testing-fundamentals

Auto-invoke when reviewing test files or discussing testing strategy. Enforces testing pyramid, strategic coverage, and stack-appropriate frameworks.

335 Updated today
aiskillstore
Testing & QA Listed

vitest-testing

**AI-friendly comprehensive testing guidance for Vitest with practical patterns and behavior-driven development.**

335 Updated today
aiskillstore
Testing & QA Solid

javascript-testing-patterns

Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end testing with mocking, fixtures, and test-driven development. Use when writing JavaScript/TypeScript tests, setting up test infrastructure, or implementing TDD/BDD workflows.

36,166 Updated yesterday
wshobson
Testing & QA Listed

javascript-testing-patterns

Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end testing with mocking, fixtures, and test-driven development. Use when writing JavaScript/TypeScript tests, setting up test infrastructure, or implementing TDD/BDD workflows.

21 Updated 5 days ago
HermeticOrmus
Testing & QA Listed

javascript-testing-patterns

Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end testing with mocking, fixtures, and test-driven development. Use when writing JavaScript/TypeScript tests, setting up test infrastructure, or implementing TDD/BDD workflows.

0 Updated today
NaetheraS