Vitest Config Validator

Dev Tools

Validate vitest.config.ts/js and vitest workspace configurations for syntax, deprecated options, plugin conflicts, and best practices. Use when validating Vitest test runner configs, auditing test setups, or linting vitest.config files.

Install

openclaw skills install vitest-config-validator

Vitest Config Validator

Validate vitest.config.ts and vitest.config.js files for syntax errors, deprecated options, plugin conflicts, and best practices. Parses config files as text using regex patterns — no JS execution required.

Commands

# Full validation (all rules)
python3 scripts/vitest_config_validator.py validate vitest.config.ts

# Quick syntax-only check (structure rules only)
python3 scripts/vitest_config_validator.py check vitest.config.ts

# Explain config in human-readable form
python3 scripts/vitest_config_validator.py explain vitest.config.ts

# Suggest improvements
python3 scripts/vitest_config_validator.py suggest vitest.config.ts

# JSON output
python3 scripts/vitest_config_validator.py validate vitest.config.ts --format json

# One-line PASS/WARN/FAIL summary
python3 scripts/vitest_config_validator.py validate vitest.config.ts --format summary

# Strict mode (warnings become errors)
python3 scripts/vitest_config_validator.py validate vitest.config.ts --strict

Rules (22)

#CategorySeverityRule
S1StructureEFile not found or unreadable
S2StructureEEmpty config or no defineConfig call
S3StructureWNo default export found
S4StructureWBoth vitest.config and vite.config with test section detected
S5StructureWUnknown top-level config keys
T1Test SettingsEInvalid test environment (must be jsdom/happy-dom/node/edge-runtime)
T2Test SettingsWEmpty include or exclude patterns
T3Test SettingsEInvalid glob pattern in include/exclude
T4Test SettingsICoverage provider not set (recommend c8/v8/istanbul)
T5Test SettingsWtestTimeout set unreasonably high (>60000ms) or low (<100ms)
P1PerformanceWsingleThread: true used with forks pool (disables parallelism)
P2PerformanceWisolate: false without comment (risky for test isolation)
P3PerformanceINo pool configuration (defaults may not be optimal)
P4PerformanceWglobals: true without type declaration reference
C1CompatibilityWDeprecated option used
C2CompatibilityWcss.modules without css.include (potential miss)
C3CompatibilityWdeps.inline and deps.external conflict
B1Best PracticesINo reporter configured
B2Best PracticesIMissing coverage configuration
B3Best PracticesWsetupFiles references potentially non-existent pattern
B4Best PracticesIsnapshotFormat not explicitly configured
B5Best PracticesIpassWithNoTests not set (CI may fail on empty test suite)

Output Formats

  • text (default): Human-readable with [E]/[W]/[I] severity prefix
  • json: Machine-readable structured output
  • summary: Single-line PASS / WARN / FAIL

Exit Codes

  • 0 — No errors
  • 1 — Errors found (or warnings in --strict mode)
  • 2 — File not found or parse error