This project provides a comprehensive test suite for the global pre-commit hook system.
test-precommit.sh- Main test runner that exercises all code paths
- Performance analysis tools for measuring pre-commit hook execution times
- See profiling-readme.md for detailed documentation on profiling tools
tests/valid/- Clean files that should pass all pre-commit checkstests/auto-fixable/- Files with formatting issues that can be automatically fixedtests/non-fixable/- Files with structural errors requiring manual intervention
.pre-commit-config.yaml- Local config that excludes test files from pre-commit hooks- Uses global pre-commit config at
$HOME/.config/pre-commit/config.yamlfor actual testing
Run the complete test suite:
./test-precommit.shThis will test all three scenarios:
- Clean files (should pass without issues)
- Auto-fixable files (should be fixed and require re-staging)
- Non-fixable files (should fail with errors that cannot be auto-fixed)
- Shell scripts (shellcheck, shfmt)
- Python files (black, flake8)
- YAML files (yamllint)
- HTML files (tidy)
- Markdown files (markdownlint)
The test files in auto-fixable/ and non-fixable/ directories are excluded from
the local pre-commit hooks to preserve their intentionally broken state. The test
harness runs against these files using the global configuration to validate that
all code paths in the pre-commit system work correctly.