Validate jest.config.ts, jest.config.js, jest.config.json, and package.json#jest for deprecated options, transform conflicts, coverage misconfigurations, and best practices. Supports text, JSON, and summary output formats with CI-friendly exit codes.
bash
# Full validation (all 22+ rules)
python3 scripts/jest_config_validator.py validate jest.config.js
# Quick syntax-only check (structure rules only)
python3 scripts/jest_config_validator.py check jest.config.ts
# Explain config in human-readable form
python3 scripts/jest_config_validator.py explain jest.config.json
# Suggest improvements
python3 scripts/jest_config_validator.py suggest package.json
# JSON output (CI-friendly)
python3 scripts/jest_config_validator.py validate jest.config.js --format json
# Summary only (pass/fail + counts)
python3 scripts/jest_config_validator.py validate jest.config.js --format summary
# Strict mode (warnings become errors)
python3 scripts/jest_config_validator.py validate jest.config.js --strict
#CategorySeverityRuleS1StructureErrorFile not found or unreadableS2StructureErrorEmpty config or missing module.exports/export defaultS3StructureWarningBoth jest.config and package.json#jest present (conflict)S4StructureWarningUnknown top-level config keys detectedS5StructureErrorInvalid JSON syntax (for .json configs)T1Test EnvironmentErrorInvalid testEnvironment valueT2Test EnvironmentWarningtestEnvironment: jsdom without jest-environment-jsdom (Jest 28+)T3Test EnvironmentWarningtestURL deprecated in Jest 28+ (use testEnvironmentOptions)T4Test EnvironmentWarningEmpty testMatch or testPathPatternX1TransformsWarningOverlapping transform patterns (conflict)X2TransformsWarningts-jest and babel-jest used together without clear separationX3TransformsWarningtransformIgnorePatterns too broad (may skip needed transforms)X4TransformsWarningMissing transform for .tsx/.jsx when React detectedV1CoverageWarningcollectCoverageFrom empty or too broadV2CoverageWarningcoverageThreshold set but collectCoverage not enabledV3CoverageWarningDeprecated coverageReporters valuesD1DeprecatedWarningDeprecated Jest options detectedD2DeprecatedWarningjest.fn() used inside config file (configs should not mock)D3DeprecatedWarningtimers: 'fake' (old syntax, use fakeTimers object)B1Best PracticesInfoNo clearMocks/resetMocks/restoreMocks setB2Best PracticesWarningroots pointing outside project directoryB3Best PracticesWarningsetupFiles/setupFilesAfterFramework path pattern issuesB4Best PracticesInfomoduleNameMapper with complex regex missing commentB5Best PracticesWarningpreset and manual config overlapB6Best PracticesWarningmaxWorkers set to 1 in non-CI context
text (default): Human-readable with file path, rule code, severity, and message per finding.
json: Machine-readable JSON with file, summary, and findings array. Each finding has rule, severity, message, and line fields.
summary: One-line pass/fail with error/warning/info counts. Ideal for CI output gates.
CodeMeaning0No errors found (warnings/info may exist)1One or more errors found2File not found or parse error