vitest-runner
Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.
Best use case
vitest-runner is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.
Teams using vitest-runner should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/vitest-runner/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How vitest-runner Compares
| Feature / Agent | vitest-runner | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
SKILL.md Source
# Vitest Runner Skill
## Purpose
Single responsibility: Execute and manage Vitest test suites with proper configuration, coverage reporting, and failure analysis. (BP-4)
## Grounding Checkpoint (Archetype 1 Mitigation)
Before executing, VERIFY:
- [ ] Node.js installed and version appropriate
- [ ] package.json exists with vitest dependency
- [ ] Test files exist (*.test.ts, *.spec.ts)
- [ ] vitest.config.ts or vite.config.ts present (optional)
**DO NOT run tests without verifying node_modules installed.**
## Uncertainty Escalation (Archetype 2 Mitigation)
ASK USER instead of guessing when:
- Multiple test configurations detected
- Coverage threshold unclear
- Watch mode vs single run
- Specific test patterns needed
**NEVER modify test configurations without user approval.**
## Context Scope (Archetype 3 Mitigation)
| Context Type | Included | Excluded |
|--------------|----------|----------|
| RELEVANT | Test files, vitest config, package.json | Application logic |
| PERIPHERAL | Coverage reports, test utilities | Build configs |
| DISTRACTOR | Deployment configs | Other frameworks |
## Workflow Steps
### Step 1: Environment Check (Grounding)
```bash
# Verify Node.js
node --version
npm --version
# Check vitest installed
npx vitest --version || npm install -D vitest
# List test files
find . -name "*.test.ts" -o -name "*.spec.ts" | grep -v node_modules | head -20
```
### Step 2: Discover Tests
```bash
# Show test collection
npx vitest --run --reporter=verbose --passWithNoTests 2>&1 | head -50
# List test files
npx vitest list
```
### Step 3: Execute Tests
**Basic execution:**
```bash
npx vitest run
```
**With coverage:**
```bash
npx vitest run --coverage
```
**Specific file or pattern:**
```bash
npx vitest run src/utils.test.ts
npx vitest run --grep "authentication"
```
**Watch mode:**
```bash
npx vitest --watch
```
**Parallel execution:**
```bash
npx vitest run --pool threads --poolOptions.threads.maxThreads 4
```
### Step 4: Analyze Results
```bash
# Verbose output with failures
npx vitest run --reporter=verbose 2>&1 | tee test_results.txt
# Extract failures
grep -E "^FAIL|AssertionError|Error:" test_results.txt
# Coverage summary
npx vitest run --coverage --coverage.reporter=text-summary
```
## Recovery Protocol (Archetype 4 Mitigation)
On error:
1. **PAUSE** - Capture test output
2. **DIAGNOSE** - Check error type:
- `Cannot find module` → Check imports, tsconfig paths
- `SyntaxError` → Check TypeScript compilation
- `Timeout` → Increase timeout or check async handling
- `ENOENT` → Check file paths, fixtures
3. **ADAPT** - Adjust test selection or configuration
4. **RETRY** - With narrower scope (max 3 attempts)
5. **ESCALATE** - Report failures with context
## Checkpoint Support
State saved to: `.aiwg/working/checkpoints/vitest-runner/`
```
checkpoints/vitest-runner/
├── test_collection.json # Discovered tests
├── test_results.json # Last run results
├── coverage_report.json # Coverage data
└── failure_analysis.md # Failure diagnostics
```
## Common Vitest Options
| Option | Purpose |
|--------|---------|
| `--run` | Single run (no watch) |
| `--watch` | Watch mode |
| `--coverage` | Generate coverage |
| `--reporter=verbose` | Detailed output |
| `--grep "pattern"` | Filter tests |
| `--bail` | Stop on first failure |
| `--update` | Update snapshots |
| `--ui` | Open UI |
## Configuration Templates
**vitest.config.ts:**
```typescript
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
include: ['**/*.{test,spec}.{js,ts}'],
exclude: ['node_modules', 'dist'],
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'json'],
exclude: ['node_modules/', 'test/']
},
globals: true,
environment: 'node'
}
})
```
## References
- Vitest documentation: https://vitest.dev/
- REF-001: Production-Grade Agentic Workflows (BP-4 single responsibility)
- REF-002: LLM Failure Modes (Archetype 1 grounding)Related Skills
pytest-runner
Execute Python tests with pytest, supporting fixtures, markers, coverage, and parallel execution. Use for Python test automation.
aiwg-orchestrate
Route structured artifact work to AIWG workflows via MCP with zero parent context cost
venv-manager
Create, manage, and validate Python virtual environments. Use for project isolation and dependency management.
eslint-checker
Run ESLint for JavaScript/TypeScript code quality and style enforcement. Use for static analysis and auto-fixing.
repo-analyzer
Analyze GitHub repositories for structure, documentation, dependencies, and contribution patterns. Use for codebase understanding and health assessment.
pr-reviewer
Review GitHub pull requests for code quality, security, and best practices. Use for automated PR feedback and approval workflows.
YouTube Acquisition
yt-dlp patterns for acquiring content from YouTube and video platforms
Quality Filtering
Accept/reject logic and quality scoring heuristics for media content
Provenance Tracking
W3C PROV-O patterns for tracking media derivation chains and production history
Metadata Tagging
opustags and ffmpeg patterns for applying metadata to audio and video files
Audio Extraction
ffmpeg patterns for extracting audio from video files and transcoding between formats
Archive Acquisition
Patterns for acquiring content from Internet Archive and archival sources