unit-testing

Test individual functions and modules with Vitest in Node.js.

39|3|Updated Nov 21, 2025
One-click install
npx skills add https://github.com/LiorCohen/sdd --skill unit-testing-liorcohen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unit-testing
Source: https://github.com/LiorCohen/sdd/tree/main/plugin/fullstack-typescript/skills/unit-testing
Command: npx skills add https://github.com/LiorCohen/sdd --skill unit-testing-liorcohen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unit tests verify the behavior of individual functions and modules in isolation, catching regressions early and providing rapid feedback during development and CI.

Core Features & Use Cases

  • Tests near code: place unit tests next to the source files to ensure maintainability and quick iteration.
  • Vitest-based patterns: use mocking, fixtures, and isolation to validate behavior without external side effects.
  • Use Case: confidently refactor code and verify changes without integration overhead.

Quick Start

Run the unit tests for a module with Vitest to verify isolation and fast feedback.

Frequently Asked Questions about unit-testing

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

FAQPage Schema
How do I write isolated unit tests in TypeScript using Vitest?

Vitest unit tests verify individual functions and modules in isolation using mocking and fixtures to validate behavior without side effects. This approach provides rapid feedback during development and CI.

What is the best way to structure unit tests for rapid feedback in CI?

The best way to structure unit tests for rapid CI feedback is placing test files next to source code to ensure maintainability. Using Vitest patterns for isolation and deterministic results guarantees fast execution and quick iteration.

Can I use Vitest mocking and fixtures for Node.js software projects?

Yes, Vitest mocking and fixtures work for Node.js software projects to validate behavior without external side effects. This ensures tests remain isolated and produce deterministic results across different code modules.

Do I need integration tests if I have isolated unit tests covering my modules?

Isolated unit tests verify individual functions and modules to catch regressions early, reducing integration overhead. They allow confident code refactoring and verify changes rapidly, though they focus on isolated behavior rather than full system integration.

How does Vitest handle discriminated unions coverage in unit testing?

Vitest handles discriminated unions coverage by validating individual functions and modules to ensure correctness. Unit tests verify that all union variants are processed correctly, providing deterministic results and clear naming for maintainability.