PackageTestScriptsConfig
Defined in: policies/PackageTestScripts.ts:32
Configuration for the PackageTestScripts policy.
This policy ensures that packages have appropriate test scripts when they contain test files or have test-related dependencies.
The policy automatically determines what to check based on what’s configured:
- If
testDirectoriesis set, checks for test directories - If
testDependenciesis set, checks for test dependencies - If both are set, a package triggers validation if either condition is met
Example
Section titled “Example”const config: PackageTestScriptsConfig = { // Check for these test directories testDirectories: ["test", "tests", "__tests__"], // Require test script if these devDependencies exist testDependencies: ["vitest", "jest", "mocha"], // Required test script names requiredScripts: ["test"],};Properties
Section titled “Properties”excludePackages?
Section titled “excludePackages?”
optionalexcludePackages?:string[]
Defined in: policies/PackageTestScripts.ts:73
Package names or scopes to exclude from validation.
requiredScripts?
Section titled “requiredScripts?”
optionalrequiredScripts?:string[]
Defined in: policies/PackageTestScripts.ts:68
Script names that must exist when tests are detected.
Default Value
Section titled “Default Value”["test"]testDependencies?
Section titled “testDependencies?”
optionaltestDependencies?:string[]
Defined in: policies/PackageTestScripts.ts:61
Test framework dependencies that indicate tests are expected.
If any of these appear in devDependencies, the policy will require test scripts to be present.
If not set or empty, dependency checking is skipped.
Example
Section titled “Example”testDependencies: ["vitest", "jest", "mocha", "@jest/globals"]testDirectories?
Section titled “testDirectories?”
optionaltestDirectories?:string[]
Defined in: policies/PackageTestScripts.ts:46
Directory names that indicate test files are present.
If any of these directories exist relative to the package.json, the policy will require test scripts to be present.
If not set or empty, directory checking is skipped.
Example
Section titled “Example”testDirectories: ["test", "tests", "__tests__"]