testing

Guide writing, organizing, and debugging Vitest tests across codebases.

1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/andershi666/lobehub-hr-demo --skill testing-andershi666
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/andershi666/lobehub-hr-demo/tree/main/lobehub/.agents/skills/testing
Command: npx skills add https://github.com/andershi666/lobehub-hr-demo --skill testing-andershi666

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing, organizing, and debugging Vitest tests can be error-prone and time-consuming without a structured guide.

Core Features & Use Cases

  • Clear best-practices for structuring tests, mocking, and spying on dependencies.
  • Strategies for failing tests, test maintenance, and referencing common scenarios across Webapp, Packages, and Desktop codebases.
  • Real-world examples and patterns to improve test reliability and coverage.

Quick Start

Run targeted Vitest tests for a specific file using bunx vitest run --silent='passed-only' '[path-to-test]'.

Frequently Asked Questions about testing

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

FAQPage Schema
What is the best way to structure Vitest tests for a Webapp codebase?

The best way to structure Vitest tests involves following a structured guide that enforces best practices for organizing tests across Webapp, Packages, and Desktop codebases. This approach improves test reliability and coverage by referencing dedicated guidance in references/.

How do I use vi.spyOn instead of broad vi.mock for mocking dependencies?

To use vi.spyOn instead of broad vi.mock, apply the Skill's mocking strategies that enforce best practices for spying on dependencies. This targeted approach avoids the pitfalls of broad mocking and ensures reliable test behavior across your codebases.

How do I run targeted Vitest tests for a specific file?

To run targeted Vitest tests for a specific file, execute the command `bunx vitest run --silent='passed-only' '[path-to-test]'`. This allows you to isolate and debug specific test scenarios efficiently during maintenance workflows.

Does this Vitest guidance cover test maintenance and failing test strategies?

Yes, this Vitest guidance covers strategies for failing tests and test maintenance across Webapp, Packages, and Desktop codebases. It provides real-world examples and patterns to improve test reliability and coverage while debugging.

Why should I avoid broad vi.mock when writing unit tests?

You should avoid broad vi.mock because it can introduce errors and reduce test reliability. The Skill enforces best practices by using vi.spyOn for mocking dependencies, providing a more targeted and reliable testing pattern for your codebase.