Use this checklist to verify the test coverage reporting and threshold enforcement is working correctly.
-
jest.config.jscontainscoverageReportersarray -
coverageDirectoryis set to'coverage' -
coverageThreshold.globalhas all four metrics at 30% -
collectCoverageFromincludessrc/**/*.js -
collectCoverageFromexcludes scripts and config
-
testscript runs jest -
test:coveragescript runs jest with --coverage -
test:coverage:ciscript includes --ci and --maxWorkers flags -
check-coveragescript points to scripts/check-coverage.js
-
.github/workflows/coverage.ymlexists - Coverage workflow runs on PR and push to main/develop
- Workflow includes environment variables (MOCK_STELLAR, API_KEYS)
- Workflow uploads coverage artifacts
-
.github/workflows/ci.ymlincludes coverage job
cd Stellar-Micro-Donation-API
npm run test:coverageVerify:
- Tests run successfully
- Coverage summary appears in terminal
-
coverage/directory is created -
coverage/lcov-report/index.htmlexists -
coverage/lcov.infoexists -
coverage/coverage-summary.jsonexists
npm run check-coverageVerify:
- Script runs without errors
- Shows coverage for all 4 metrics
- Displays pass/fail status for each metric
- Shows minimum threshold (30%) for each metric
- Exits with code 0 if all pass
# macOS
open coverage/lcov-report/index.html
# Windows
start coverage/lcov-report/index.html
# Linux
xdg-open coverage/lcov-report/index.htmlVerify:
- HTML report opens in browser
- Shows file list with coverage percentages
- Can navigate to individual files
- Uncovered lines highlighted in red
- Covered lines highlighted in green
- Branch coverage indicators visible
git checkout -b test/coverage-verification
git push origin test/coverage-verificationVerify:
- Coverage workflow triggers automatically
- Workflow appears in GitHub Actions tab
Navigate to GitHub Actions → Coverage workflow
Verify:
- Workflow runs to completion
- "Run tests with coverage" step succeeds
- Coverage summary visible in logs
- "Upload coverage report" step succeeds
- Artifact appears in workflow summary
Click on coverage-report artifact in workflow
Verify:
- Artifact downloads successfully
- Contains lcov-report directory
- Contains lcov.info file
- Contains coverage-summary.json
Temporarily lower threshold in jest.config.js to 99%:
coverageThreshold: {
global: {
branches: 99,
functions: 99,
lines: 99,
statements: 99,
},
}Commit and push:
git add jest.config.js
git commit -m "Test: Lower thresholds to verify enforcement"
git pushVerify:
- Coverage workflow runs
- Workflow fails (red X)
- Error message indicates threshold not met
- Build is blocked
Revert changes:
git revert HEAD
git pushVerify:
- Workflow runs again
- Workflow succeeds (green checkmark)
-
docs/COVERAGE_GUIDE.mdexists -
docs/COVERAGE_IMPLEMENTATION_COMPLETE.mdexists -
COVERAGE_QUICK_REFERENCE.mdexists -
TASK_COMPLETION_SUMMARY.mdexists -
COVERAGE_VERIFICATION_CHECKLIST.mdexists (this file)
- Testing section includes coverage commands
- Contributing section mentions coverage requirements
- Links to coverage documentation present
- Coverage guide explains all metrics
- Guide includes troubleshooting section
- Implementation doc lists all modified files
- Quick reference has essential commands
- Task summary confirms acceptance criteria met
-
coverage/directory in .gitignore - Coverage reports not committed to repo
- Only configuration files tracked
Test the complete developer workflow:
- Make a code change
- Run
npm test - Run
npm run test:coverage - Run
npm run check-coverage - View HTML report
- Commit changes
- Push to GitHub
- Create PR
Verify:
- All commands work without errors
- Coverage workflow runs on PR
- PR shows coverage status
- Can merge if coverage passes
Create a new file without tests:
echo "function untested() { return true; }" > src/untested.js
git add src/untested.js
git commit -m "Add untested code"
git pushVerify:
- Coverage workflow runs
- Coverage percentage drops
- If below 30%, build fails
- Clear error message shown
Clean up:
git revert HEAD
git pushrm -rf coverage
npm run check-coverageVerify:
- Script detects missing coverage file
- Shows error message
- Suggests running
npm run test:coverage - Exits with non-zero code
Regenerate:
npm run test:coveragetime npm run test:coverageVerify:
- Completes in reasonable time (< 2 minutes)
- No memory issues
- All reports generated
Check workflow execution time in GitHub Actions
Verify:
- Coverage job completes in < 5 minutes
- No timeout issues
- Artifact upload succeeds
- ✅ Coverage report generated on test run
- ✅ Builds fail if coverage drops below thresholds
- ✅ Coverage tooling configured
- ✅ Minimum thresholds defined (30%)
- ✅ CI/CD integration complete
- ✅ Documentation created
- No syntax errors in configuration files
- No broken links in documentation
- All scripts executable
- All workflows valid YAML
If all items are checked, the test coverage reporting and threshold enforcement implementation is complete and working correctly!
If any verification fails:
- Check error messages - They usually indicate the issue
- Review logs - GitHub Actions logs show detailed output
- Verify configuration - Ensure all config files match documentation
- Check dependencies - Run
npm installto ensure all packages installed - Consult documentation - See
docs/COVERAGE_GUIDE.mdfor help
For issues:
- Review
docs/COVERAGE_GUIDE.mdtroubleshooting section - Check GitHub Actions workflow logs
- Verify all configuration files
- Ensure Node.js and npm are up to date