The agent enforces mandatory test completion before any task or feature can be marked as done, ensuring code quality through strict validation gates and evidence-based completion criteria.
This skill defines the enforcement rules and mechanisms that ensure tests are written, executed, and passing before any implementation work can be considered complete. It provides a framework for blocking premature completion and requiring evidence of test coverage.
No code is "done" without tests.
Definition of Done:
āāā Code implemented ā
āāā Tests written ā
āāā Tests passing ā
āāā Coverage met ā
āāā Review approved ā
āāā THEN ā Done
# .omgkit/workflow.yaml
testing:
enabled: true
enforcement:
level: standard # soft | standard | strict
requirements:
unit_tests: required
integration_tests: required
e2e_tests: optional
security_tests: conditional # Required for auth features
coverage_gates:
unit:
minimum: 80
target: 90
block_below: 70
integration:
minimum: 60
target: 75
block_below: 50
overall:
minimum: 75
target: 85
blocking:
on_test_failure: true
on_coverage_below_minimum: true
on_missing_test_types: true
overrides:
allow_emergency: true
require_approval: true
log_all_overrides: true
# Set enforcement level
omgkit config set testing.enforcement.level strict
# View current configuration
omgkit config get testing.enforcement.level
# List all testing config
omgkit config list testing
Commands support per-invocation overrides:
| Option | Description | Example |
|---|---|---|
--no-test |
Skip test enforcement | /dev:fix "typo" --no-test |
--with-test |
Force test enforcement | /dev:fix-fast "bug" --with-test |
--test-level <level> |
Override enforcement level | /dev:feature "auth" --test-level strict |
--coverage <percent> |
Override coverage minimum | /dev:feature "api" --coverage 95 |
Note: --no-test requires soft enforcement level or explicit config override.
## Blocking Criteria
- [ ] **Tests Exist**: At least one test file for changed code
- [ ] **Tests Execute**: All tests run without errors
- [ ] **Tests Pass**: Zero failing tests
- [ ] **No Skipped Critical**: No skipped tests for critical paths
## Standard Criteria
- [ ] **Unit Coverage**: ā„80% line coverage
- [ ] **Branch Coverage**: ā„70% branch coverage
- [ ] **Integration Tests**: Present for API/DB changes
- [ ] **No Flaky Tests**: Tests deterministic
- [ ] **Test Isolation**: No test interdependencies
## Quality Criteria
- [ ] **Mutation Score**: ā„60% mutations killed
- [ ] **Performance Tests**: Present for perf-critical code
- [ ] **Security Tests**: Present for auth/input handling
- [ ] **E2E Tests**: Present for user-facing features
Developer: "Mark TASK-042 as done"
System Check:
āāā Has tests? ā Yes
āāā Tests passing? ā Yes
āāā Coverage ā„ 80%? ā 75% (FAIL)
āāā Block completion
Response: "Cannot mark as done. Coverage is 75%, minimum is 80%.
Add tests for uncovered lines: src/handlers/user.ts:45-52"
Developer: "Override coverage requirement"
System Check:
āāā Enforcement level? ā Standard
āāā Override allowed? ā Yes, with approval
āāā Approval required? ā Yes
āāā Request approval
Response: "Override requested. Waiting for approval from:
- Tech Lead
- QA Lead
Justification required."
Developer: "Emergency override - production hotfix"
System Check:
āāā Emergency flag? ā Yes
āāā Emergency override allowed? ā Yes
āāā Logging? ā Enabled
āāā Grant temporary override
Response: "Emergency override granted.
ā ļø This is logged and will be reviewed.
ā ļø Tests must be added within 24 hours.
ā ļø Follow-up task created: TASK-043 Add tests for hotfix"
## Required Evidence
### Test Report
- Total tests: 42
- Passed: 42
- Failed: 0
- Skipped: 0
- Duration: 3.2s
### Coverage Report
| File | Lines | Branches | Functions |
|------|-------|----------|-----------|
| user.ts | 92% | 85% | 100% |
| auth.ts | 88% | 80% | 95% |
| **Total** | **90%** | **82%** | **97%** |
### Attached Artifacts
- [ ] test-report.json
- [ ] coverage/lcov.info
- [ ] screenshots/ (for E2E)
## Override Approval
**Requested by:** developer@team.com
**Approved by:** techlead@team.com
**Reason:** Legacy code refactor - tests will be added in TASK-044
**Follow-up:** TASK-044 due in 3 days
**Logged at:** 2024-01-06T14:30:00Z
Before enforcement:
- [ ] TASK-042: Implement user endpoint
- [ ] TEST-042: Add tests for user endpoint
After attempting completion without tests:
- [x] TASK-042: Implement user endpoint
- [ ] TEST-042: Add tests for user endpoint ā ļø BLOCKING
Status: Feature blocked until TEST-042 complete
# pre-push hook
#!/bin/bash
echo "Running test enforcement checks..."
# Run tests
npm test
if [ $? -ne 0 ]; then
echo "ā Tests failing. Push blocked."
exit 1
fi
# Check coverage
coverage=$(npm run coverage:check --silent)
if [ $coverage -lt 80 ]; then
echo "ā Coverage $coverage% below minimum 80%. Push blocked."
exit 1
fi
echo "ā
Test enforcement passed."
# GitHub Actions check
name: Test Enforcement
on: [pull_request]
jobs:
enforce-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Tests
run: npm test
- name: Check Coverage
run: |
coverage=$(npm run coverage:json | jq '.total.lines.pct')
if (( $(echo "$coverage < 80" | bc -l) )); then
echo "Coverage $coverage% below minimum"
exit 1
fi
- name: Verify Test Types
run: |
if [ ! -f "tests/unit/*.test.ts" ]; then
echo "Missing unit tests"
exit 1
fi
ā COMPLETION BLOCKED: Tests Required
Your task cannot be marked as done because:
⢠No test files found for changed code
⢠Add tests to: tests/unit/user.test.ts
Run: /quality:verify-done for detailed requirements
ā COMPLETION BLOCKED: Coverage Below Minimum
Your task cannot be marked as done because:
⢠Current coverage: 72%
⢠Minimum required: 80%
Uncovered lines:
⢠src/handlers/user.ts: lines 45-52, 78-82
⢠src/services/auth.ts: lines 23-25
Run: npm run test:coverage for detailed report
ā ļø WARNING: Optional Tests Missing
Your task can be completed, but consider adding:
⢠Performance tests (recommended for API endpoints)
⢠Security tests (recommended for auth handling)
These tests improve code quality and catch issues early.
ā
TEST ENFORCEMENT PASSED
All requirements met:
⢠Tests exist: ā
⢠Tests passing: ā (42/42)
⢠Coverage: ā (92%)
⢠No skipped: ā
Task can be marked as done.
All overrides are logged:
{
"task_id": "TASK-042",
"override_type": "coverage",
"requested_by": "developer@team.com",
"approved_by": "techlead@team.com",
"reason": "Legacy code, tests in follow-up",
"follow_up_task": "TASK-043",
"timestamp": "2024-01-06T14:30:00Z",
"enforcement_level": "standard"
}
Weekly Report:
āāā Tasks completed: 42
āāā With tests: 40 (95%)
āāā Overrides used: 2 (5%)
ā āāā Emergency: 1
ā āāā Approved: 1
āāā Average coverage: 87%
āāā Test-first tasks: 15 (36%)
Coverage Trend (Last 4 Weeks):
Week 1: 78% āāāāāāāā
Week 2: 82% āāāāāāāāā
Week 3: 85% āāāāāāāāā
Week 4: 87% āāāāāāāāā
Target: 90% āāāāāāāāāā
Coverage below minimum
ā
Request override
ā
Tech Lead approval required
ā
If denied ā Add tests
ā
If approved ā Create follow-up task
ā
Complete with documented override