generated from nhcarrigan/template
docs: require tests for all changes in CLAUDE.md
This commit is contained in:
@@ -39,7 +39,7 @@ git push https://hikari:TOKEN@git.nhcarrigan.com/nhcarrigan/hikari-desktop.git <
|
|||||||
|
|
||||||
## Testing Requirements
|
## Testing Requirements
|
||||||
|
|
||||||
All new features, fixes, and significant changes should include tests whenever possible:
|
**All changes MUST include tests.** This is non-negotiable — no feature, bug fix, or refactor should be committed without corresponding test coverage. If a change cannot be tested (e.g. pure UI layout, Tauri IPC calls that are impossible to mock), document why in a comment.
|
||||||
|
|
||||||
- **Frontend tests**: Use Vitest with `@testing-library/svelte` for component tests
|
- **Frontend tests**: Use Vitest with `@testing-library/svelte` for component tests
|
||||||
- **Test files**: Place test files next to the code they test with `.test.ts` or `.spec.ts` extension
|
- **Test files**: Place test files next to the code they test with `.test.ts` or `.spec.ts` extension
|
||||||
@@ -137,16 +137,16 @@ describe("FeatureName", () => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adding Tests for New Features
|
### Adding Tests for All Changes
|
||||||
|
|
||||||
When developing new features, always add corresponding tests:
|
Every change — features, bug fixes, refactors — must include tests:
|
||||||
|
|
||||||
1. **Before implementing**: Consider what needs testing (happy path, edge cases, errors)
|
1. **Before implementing**: Consider what needs testing (happy path, edge cases, errors)
|
||||||
2. **During implementation**: Write tests alongside the code
|
2. **During implementation**: Write tests alongside the code
|
||||||
3. **After implementation**: Run `pnpm test:coverage` to verify coverage remains high
|
3. **After implementation**: Run `pnpm test:coverage` to verify coverage remains high
|
||||||
4. **Before committing**: Ensure `check-all.sh` passes (includes all tests)
|
4. **Before committing**: Ensure `check-all.sh` passes (includes all tests)
|
||||||
|
|
||||||
The goal is to maintain our near-100% coverage as the codebase grows, so future refactoring and changes can be made with confidence!
|
**Do not commit changes without tests.** The goal is to maintain near-100% coverage as the codebase grows, so future refactoring can be done with confidence!
|
||||||
|
|
||||||
## Quality Assurance
|
## Quality Assurance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user