testing

Write, organize, and debug Vitest-based unit tests across codebases.

Updated Dec 12, 2024
One-click install
npx skills add https://github.com/kingmacth/lobe-chat --skill testing-kingmacth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/kingmacth/lobe-chat/tree/main/.agents/skills/testing
Command: npx skills add https://github.com/kingmacth/lobe-chat --skill testing-kingmacth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Vitest-based testing workflows across a project; this guide helps teams write, organize, and maintain unit tests efficiently.

Core Features & Use Cases

  • Test creation & debugging: Create focused unit tests alongside source files and debug failures efficiently.
  • Mock setup & coverage improvement: Provide patterns for mocking dependencies and increasing test coverage across modules.
  • Reference-guided scenarios: Leverage the curated references to cover common testing scenarios like database models, IPC, and state management.

Quick Start

Create a new test file next to your source code and begin with a simple unit test using Vitest.

Frequently Asked Questions about testing

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

FAQPage Schema
How do I set up mocking for dependencies in Vitest unit tests?

To set up mocking in Vitest unit tests, you apply patterns for mocking dependencies and increasing test coverage across modules. This guide provides structured workflows for configuring mocks to isolate modules during test creation.

Can I use Vitest to test database models and state management workflows?

Yes, you can use Vitest to test database models and state management workflows. The guide provides reference-guided scenarios covering common testing targets like IPC, state management, and database models for web, desktop, and library projects.

What's the best way to organize and debug Vitest test files across a project?

The best way to organize Vitest test files is to create focused unit tests alongside source files. This approach allows you to debug failures efficiently and maintain test coverage across your codebase.

Do I need an existing Vitest configuration to start writing unit tests?

Yes, you need a Vitest configuration to use this workflow. The guide integrates with inline references and requires existing setup to provide guided workflows and best-practice patterns for your test creation.

How does reference-guided testing help improve codebase coverage?

Reference-guided testing improves codebase coverage by leveraging curated references to cover common testing scenarios. It provides patterns for mocking dependencies and structuring tests to systematically increase coverage across web, desktop, and library modules.