hooks-configs/hook-test-runner

Run tests related to changed files before committing

Pre-commit hook that runs tests for changed files. Uses test framework's built-in related test detection to only run relevant tests, keeping commits fast while ensuring coverage.

Content
{
  "hooks": {
    "pre-commit": [
      {
        "name": "test-related",
        "command": "npx jest --bail --findRelatedTests",
        "match": "**/*.{js,jsx,ts,tsx}",
        "description": "Run tests related to changed files"
      }
    ]
  }
}

Details

Categoryhooks-configs
Tagstestingpre-commitautomationintermediate
LicenseMIT
AuthorClaude Code Directory
Difficultyintermediate