Test Runner Hook
Run tests related to changed files before committing
Category:hooks-configs
Type:hook
Difficulty:intermediate
testing
pre-commit
automation
intermediate
Description
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
Resource Content
{
"hooks": {
"pre-commit": [
{
"name": "test-related",
"command": "npx jest --bail --findRelatedTests",
"match": "**/*.{js,jsx,ts,tsx}",
"description": "Run tests related to changed files"
}
]
}
}Rate This Resource
0
Help others discover great resources
Statistics
0
Stars
0
Copies
404
Days ago
252
Views