Back to skills
SkillHub ClubShip Full StackFull StackTesting

Testing Vitest

Your approach to handling testing vitest. Use this skill when working on files where testing vitest comes into play.

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
8
Hot score
84
Updated
March 20, 2026
Overall rating
C2.2
Composite score
2.2
Best-practice grade
C64.0

Install command

npx @skill-hub/cli install leaderiop-hex-di-testing-vitest
testingvitesttypescriptunit-testingcode-quality

Repository

leaderiop/hex-di

Skill path: .claude/skills/testing-vitest

Your approach to handling testing vitest. Use this skill when working on files where testing vitest comes into play.

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack, Testing.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: leaderiop.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install Testing Vitest into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/leaderiop/hex-di before adding Testing Vitest to shared team environments
  • Use Testing Vitest for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: Testing Vitest
description: Your approach to handling testing vitest. Use this skill when working on files where testing vitest comes into play.
---

# Testing Vitest

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle testing vitest.

## Instructions

For details, refer to the information provided in this file:
[testing vitest](../../../agent-os/standards/testing/vitest.md)


---

## Referenced Files

> The following files are referenced in this skill and included for context.

### ../../../agent-os/standards/testing/vitest.md

```markdown
# Vitest Testing Standards for HexDI

## Configuration

### Workspace Setup
- Root `vitest.config.ts` for shared configuration
- Per-package configs extend root
- Workspace mode for monorepo

### TypeScript Integration
- Use `vitest/config` for TypeScript support
- Match `tsconfig.json` paths
- Enable source maps for debugging

## Test Organization

### File Structure
- Tests co-located with source: `*.test.ts`
- Integration tests in `__tests__/` folder
- E2E tests in dedicated `e2e/` folder

### Naming Conventions
- `describe` blocks match module/class names
- `it` statements describe behavior, not implementation
- Use nested `describe` for related scenarios

## Test Categories

### Unit Tests
- Test individual functions/classes in isolation
- Mock external dependencies
- Fast execution (< 100ms per test)

### Integration Tests
- Test package interactions
- Use real implementations where practical
- Test graph composition scenarios

### Type Tests
- Dedicated files: `*.type-test.ts`
- Use `expectTypeOf` from vitest
- Test type inference and error cases

## Coverage

### Requirements
- Core packages: 90%+ line coverage
- Focus on branch coverage for complex logic
- Coverage reports in CI

### Exclusions
- Type-only files
- Index/barrel files
- Development utilities

## Mocking

### Principles
- Prefer dependency injection over mocking
- Mock at boundaries (external APIs, timers)
- Use `vi.fn()` for spy functionality

### Reset
- Clear mocks in `beforeEach`
- Use `vi.restoreAllMocks()` in global setup
- Avoid test pollution

## Assertions

### Style
- Use `expect` fluent API
- Prefer specific matchers over generic equality
- Custom matchers for domain concepts

### Async Testing
- Use async/await, not callbacks
- Test rejection cases explicitly
- Handle timeouts appropriately

```