检查 vitest.config.ts/js 和 vitest 工作区配置的语法、废弃选项、插件冲突和最佳实践。用于验证 Vitest 配置。
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.
bash
# 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
#CategorySeverityRuleS1StructureEFile not found or unreadableS2StructureEEmpty config or no defineConfig callS3StructureWNo default export foundS4StructureWBoth vitest.config and vite.config with test section detectedS5StructureWUnknown top-level config keysT1Test SettingsEInvalid test environment (must be jsdom/happy-dom/node/edge-runtime)T2Test SettingsWEmpty include or exclude patternsT3Test SettingsEInvalid glob pattern in include/excludeT4Test 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 referenceC1CompatibilityWDeprecated option usedC2CompatibilityWcss.modules without css.include (potential miss)C3CompatibilityWdeps.inline and deps.external conflictB1Best PracticesINo reporter configuredB2Best PracticesIMissing coverage configurationB3Best PracticesWsetupFiles references potentially non-existent patternB4Best PracticesIsnapshotFormat not explicitly configuredB5Best PracticesIpassWithNoTests not set (CI may fail on empty test suite)
[E]/ [W]/ [I] severity prefixPASS / WARN / FAIL0 — No errors1 — Errors found (or warnings in --strict mode)2 — File not found or parse error