From vitest
Full API reference for @savvy-web/vitest configuration. Use when modifying vitest.config.ts — covers VitestConfigOptions, VitestProject factories, mutation methods, coverage level presets, and common recipes.
npx claudepluginhub savvy-web/systems --plugin vitestThis skill uses the workspace's default tool permissions.
```typescript
Implements Playwright E2E testing patterns: Page Object Model, test organization, configuration, reporters, artifacts, and CI/CD integration for stable suites.
Guides Next.js 16+ Turbopack for faster dev via incremental bundling, FS caching, and HMR; covers webpack comparison, bundle analysis, and production builds.
Discovers and evaluates Laravel packages via LaraPlugins.io MCP. Searches by keyword/feature, filters by health score, Laravel/PHP compatibility; fetches details, metrics, and version history.
import { VitestConfig } from "@savvy-web/vitest";
export default VitestConfig.create(options?, postProcess?);
VitestConfig.create() auto-discovers workspace packages with src/
directories, classifies test files by filename convention, and generates
multi-project Vitest configs. Do not manually define test projects.
Type: CoverageLevelName | CoverageThresholds
Default: "none"
Coverage thresholds that fail tests when not met. Use a named level or an explicit object.
Named levels (lines / branches / functions / statements):
| Level | lines | branches | functions | statements |
|---|---|---|---|---|
none | 0 | 0 | 0 | 0 |
basic | 50 | 50 | 50 | 50 |
standard | 70 | 65 | 70 | 70 |
strict | 80 | 75 | 80 | 80 |
full | 90 | 85 | 90 | 90 |
Access programmatically via VitestConfig.COVERAGE_LEVELS.standard.
Type: CoverageLevelName | CoverageThresholds
Default: "basic"
Thresholds forwarded to vitest-agent-reporter. These are
informational only — they do not cause test failures. The reporter
uses them to identify coverage gaps.
Type: string[]
Additional glob patterns excluded from coverage reporting, appended to the built-in exclusions.
Type: boolean | AgentReporterConfig
Default: true
Controls injection of the vitest-agent-reporter plugin. When true,
injects with default options. When an AgentReporterConfig object,
passes the options through. When false, disables injection.
Type: "threads" | "forks" | "vmThreads" | "vmForks"
Default: Vitest default (threads)
Vitest pool mode. Use "forks" for Effect-TS compatibility.
Type: KindOverride
Per-kind overrides applied to all projects of that test kind.
Object form — merged into every project's test config:
VitestConfig.create({
e2e: { testTimeout: 300_000 },
});
Callback form — receives a Map<string, VitestProject> for
fine-grained per-project mutation:
VitestConfig.create({
unit: (projects) => {
const pkg = projects.get("@savvy-web/my-lib:unit");
pkg?.addCoverageExclude("**/generated/**");
},
});
Type: (config: ViteUserConfig) => ViteUserConfig | undefined
Escape hatch for modifying the assembled config after all discovery
and overrides have been applied. Return a replacement config or
undefined to use the mutated original.
VitestConfig.create({}, (config) => {
config.plugins ??= [];
config.plugins.push(myPlugin());
return config;
});
Projects are created via static factory methods. Each factory applies kind-specific defaults.
| Factory | environment | testTimeout | hookTimeout | maxConcurrency |
|---|---|---|---|---|
unit() | node | vitest default | vitest default | vitest default |
int() | node | 60,000 | 30,000 | floor(cpus/2) clamped 1..8 |
e2e() | node | 120,000 | 60,000 | floor(cpus/2) clamped 1..8 |
custom(kind) | — | — | — | — |
All methods are chainable (return this):
override(config) — merge additional
TestProjectInlineConfiguration; name and include are always
preservedaddInclude(...patterns) — append glob patterns to the test
include listaddExclude(...patterns) — append glob patterns to the test
exclude listaddCoverageExclude(...patterns) — append glob patterns to
per-project coverage exclusionsname — project name (read-only)kind — test kind: "unit", "e2e", "int", or custom
(read-only)coverageExcludes — accumulated coverage exclusion patterns
(read-only)toConfig() — returns the Vitest-native
TestProjectInlineConfigurationVitestConfig.create({
coverage: "standard",
coverageTargets: "strict",
});
VitestConfig.create({
pool: "forks",
});
VitestConfig.create({
unit: (projects) => {
for (const [, project] of projects) {
project.addCoverageExclude("**/generated/**");
}
},
});
VitestConfig.create({
e2e: { testTimeout: 300_000, hookTimeout: 120_000 },
});
VitestConfig.create({}, (config) => {
config.plugins ??= [];
config.plugins.push(myVitePlugin());
return config;
});
VitestConfig.create()
handles discovery. Adding manual projects entries bypasses
conventions.VitestConfig.create() — raw Vitest config loses
auto-discovery, coverage presets, and agent-reporter integration.addInclude() via
per-kind overrides if you need extras.