- Mirror your existing unit testing setup
- Add a parallel code-coverage job
- Archive coverage reports even on failures
1. Reference: Unit Testing Job
Here’s the baselineunit-testing job in .github/workflows/ci.yml:
2. Add a Parallel Code Coverage Job
Below is thecode-coverage job that runs side by side with your unit tests:
3. Job Comparison
| Job | Node.js Version | OS Matrix | CLI Command | Artifact |
|---|---|---|---|---|
| Unit Testing | 18, 19, 20 (excl macOS 18) | ubuntu-latest, macos-latest | npm test | test-results.xml |
| Code Coverage | 18 | ubuntu-latest | npm run coverage | coverage/ directory |
4. Observe Workflow Runs
After pushing your changes, both jobs appear in the GitHub Actions UI:
5. Handling Coverage Threshold Failures
If coverage falls below your defined threshold, thenpm run coverage step will fail:

By default, a failing coverage step halts the workflow and skips artifact upload.
To ensure your coverage report is always archived, consider:
To ensure your coverage report is always archived, consider:
- Adding
continue-on-error: trueto the coverage step - Lowering your coverage thresholds in
nycconfiguration
6. Next Steps
- Explore GitHub Actions Documentation for advanced workflows
- Configure NYC thresholds in
package.json - Integrate with Codecov or other coverage services