configuring-vitest-4

Configure Vitest 4.x configs with pool, coverage, and multi-project settings.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/djankies/claude-configs --skill configuring-vitest-4
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: configuring-vitest-4
Source: https://github.com/djankies/claude-configs/tree/main/vitest-4/skills/configuring-vitest-4
Command: npx skills add https://github.com/djankies/claude-configs --skill configuring-vitest-4

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Guides configuring Vitest 4.x with pool, coverage, and multi-project setup.

Core Features & Use Cases

  • Pool and workers: maxWorkers, isolate, and fileParallelism.
  • Coverage & projects: explicit include patterns and multi-projects.
  • Use Case: migrating a mono-repo test setup.

Quick Start

Create a vitest.config.ts with multiple projects and coverage include patterns.

Frequently Asked Questions about configuring-vitest-4

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

FAQPage Schema
How do I configure Vitest 4.x for a multi-project test setup?

Vitest 4.x multi-project configuration uses defineConfig with a projects array, where each project defines its own pool, environment, and coverage settings. Structure projects as separate objects with explicit include patterns for coverage and environment-specific configurations like browser or node.

What's the difference between maxWorkers and fileParallelism in Vitest 4?

maxWorkers controls the total number of worker threads Vitest spawns, while fileParallelism determines how many test files run concurrently within each worker. Adjust both based on your CPU cores and test file count to optimize throughput without resource exhaustion.

How do I set up coverage includes patterns in Vitest 4.x?

Coverage include patterns in Vitest 4.x are defined in the coverage object within defineConfig or per-project settings. Specify file globs like src/**/*.ts to explicitly include source files for coverage reporting, filtering out test files and node_modules automatically.

Can I configure different environments like browser in separate Vitest projects?

Yes, Vitest 4.x projects support per-project environment settings. Define environment: 'browser' or environment: 'node' within each project object to run different suites in their respective environments with isolated configurations and dependencies.

What does server.deps do in Vitest 4.x configuration?

server.deps in Vitest 4.x controls how Vite pre-processes and caches dependencies during test runs. Configure it to optimize import resolution, inline certain packages, or exclude others from optimization, improving test startup and iteration speed.