aRustyDev / aRustyDev/pre-commit-hooks
test: Add comprehensive test coverage for all hooks
- 主要语言
- Python
- 星标
- 5
- 派生
- 3
- PR 合并指标
- 30 天内没有已合并 PR
描述
## Overview
Extend the bats testing framework to provide comprehensive test coverage for all 26 hook scripts.
## Current State
- Testing framework established with bats
- Sample tests created for:
- `hooks/commits/gitlint.sh`
- `hooks/nix/nix-fmt.sh`
- Test helper utilities available
- CI integration configured
## Requirements
### Test Coverage Goals
- [ ] 100% of hooks have at least basic tests
- [ ] 80%+ code coverage across all hooks
- [ ] Edge cases and error conditions tested
- [ ] Multi-platform compatibility verified
### Hooks Needing Tests
#### Commits
- [ ] commitizen.sh
- [ ] commitlint.sh
- [x] gitlint.sh ✅
#### Nix
- [ ] attestation.nix
- [ ] nix-build-check.sh
- [ ] nix-build.sh
- [ ] nix-darwin-check.sh
- [ ] nix-flake-check.sh
- [x] nix-fmt.sh ✅
- [ ] nix-home-manager-check.sh
- [ ] nix-lint.sh
- [ ] publish-to-nixpkgs.sh
#### CI
- [ ] github.sh
- [ ] gitlint.sh
#### Configs
- [ ] yamlfmt.sh
#### Terraform
- [ ] pluralith.sh
- [ ] tfupdate.sh
#### Web
- [ ] css/csslint.sh
- [ ] js/eslint.sh
- [ ] js/fixmyjs.sh
- [ ] js/jshint.sh
- [ ] scss/scss-lint.sh
#### Other
- [ ] backup-nixos.sh
- [ ] update-vm.sh
- [ ] witness.sh
- [ ] pluralith.sh (root)
## Test Structure
Each test file should include:
1. Existence and executability check
2. Missing dependency handling
3. Success case validation
4. Failure case validation
5. Edge case handling (empty input, malformed data, etc.)
## Deliverables
- [ ] Complete test suite for all hooks
- [ ] Test documentation updates
- [ ] CI passing with all tests
- [ ] Coverage report generation
- [ ] Performance benchmarks
## Success Criteria
- All hooks have corresponding test files
- Tests run successfully on Ubuntu and macOS
- Code coverage >80%
- All tests pass in CI
- Clear documentation for adding new tests
## Related
- #26 - CI/CD pipeline implementation
- #22 - Nix hooks test suite
贡献指南
调研方向
先阅读 hooks/commits/gitlint.sh 和 hooks/nix/nix-fmt.sh 的现有测试,然后检查可用的测试辅助工具并运行当前测试套件。为列表中剩余的 hook 添加相应测试,覆盖存在性、依赖项、成功、失败和边界情况。完成的标准是所有 hook 都经过测试,Ubuntu 和 macOS CI 通过,覆盖率超过 80%,并且测试文档和覆盖率报告已更新。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- testing
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100