vitest

Enforce Vitest testing standards for behavior-driven development and mocking strategies.

2|Updated Aug 8, 2024
One-click install
npx skills add https://github.com/walid-mos/mac-config --skill vitest-walid-mos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vitest
Source: https://github.com/walid-mos/mac-config/tree/main/claude/.claude/skills/vitest
Command: npx skills add https://github.com/walid-mos/mac-config --skill vitest-walid-mos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive set of standards and best practices for writing effective, maintainable, and resilient tests, ensuring code quality and preventing regressions.

Core Features & Use Cases

  • Testing Philosophy: Emphasizes testing behavior and outcomes over implementation details.
  • Resilience Rules: Guides on writing tests that are not brittle and withstand refactoring.
  • Decision Framework: A 4-gate process to determine if a test is worth writing.
  • Use Case: When developing a new feature, use these guidelines to write unit and component tests that accurately verify functionality without becoming a maintenance burden.

Quick Start

Follow the provided Vitest Standards when writing or reviewing any test file.

Frequently Asked Questions about vitest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the best way to write resilient Vitest tests?

The best way to write resilient Vitest tests is to focus on testing behavior and outcomes rather than implementation details, ensuring tests withstand refactoring without becoming brittle or causing maintenance burdens.

How do I decide if a Vitest unit test is worth writing?

To decide if a Vitest unit test is worth writing, apply a 4-gate decision framework process that evaluates the necessity of the test. This prevents unnecessary testing overhead and ensures tests provide meaningful verification.

How do I apply TDD principles with Vitest for new features?

To apply TDD principles with Vitest for new features, follow established standards that mandate test-driven development workflows and pre-push gates. This ensures consistent test execution and prevents regressions across development.

Does Vitest enforce strict mocking strategies for component testing?

Vitest enforces strict mocking strategies for component testing by establishing rigorous standards for efficient mocks. This ensures tests remain maintainable and accurately verify functionality without relying on brittle implementation details.

Why do my unit tests break during refactoring and how to prevent it?

Unit tests break during refactoring when they test implementation details instead of behavior. Prevent this by following resilience rules that focus on outcomes, ensuring tests verify functionality without becoming a maintenance burden.