Skip to content

Commit e85e9df

Browse files
lwasserJimMadge
andauthored
chore(ci): add codecov upload to tests GHA run & update dev guide (#433)
* chore: add codcov upload, secret and docs chore: add docs for codecov and secret to workflow chore: double check cov file exists? yay Apply suggestion from @lwasser sdf * Apply suggestion from @JimMadge Co-authored-by: Jim Madge <[email protected]> * Apply suggestions from code review Co-authored-by: Jim Madge <[email protected]> * Update DEVELOPMENT.md * lint --------- Co-authored-by: Jim Madge <[email protected]>
1 parent 75264bb commit e85e9df

2 files changed

Lines changed: 95 additions & 6 deletions

File tree

.github/workflows/test-deploy.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ jobs:
3030
run: pnpm build
3131

3232
- name: Run tests
33-
run: pnpm test
33+
run: pnpm test -- --coverage
3434
env:
3535
NODE_OPTIONS: --experimental-vm-modules
3636

37-
- name: Upload coverage
38-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
3939
with:
40-
name: coverage
41-
path: coverage/
42-
retention-days: 7
40+
token: ${{ secrets.CODECOV_TOKEN }}
41+
files: ./coverage/lcov.info
42+
fail_ci_if_error: false
43+
verbose: true

DEVELOPMENT.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
11
# Development Documentation
22

3+
## Testing and Code Coverage
4+
5+
### Running Tests
6+
7+
The project uses Jest for testing. To run the test suite you can use:
8+
9+
```bash
10+
npm test
11+
```
12+
13+
This runs all tests with code coverage analysis enabled.
14+
15+
### Test Configuration
16+
17+
Test configuration is in `jest.config.js`, which extends `kcd-scripts/jest` with
18+
project-specific settings:
19+
20+
```javascript
21+
const jestConfig = require('kcd-scripts/jest')
22+
23+
module.exports = Object.assign(jestConfig, {
24+
coverageThreshold: {
25+
global: {
26+
branches: 50,
27+
functions: 40,
28+
lines: 50,
29+
statements: 50,
30+
},
31+
},
32+
forceExit: true,
33+
})
34+
```
35+
36+
### Coverage Thresholds
37+
38+
The project enforces minimum code coverage thresholds through the jest
39+
configuration above:
40+
41+
| Coverage Type | Percentage |
42+
| ------------- | ---------- |
43+
| Branches | 50% |
44+
| Functions | 40% |
45+
| Lines | 50% |
46+
| Statements | 50% |
47+
48+
Tests will fail if coverage drops below these thresholds.
49+
50+
### Coverage Reports
51+
52+
When you run tests, coverage reports are automatically generated in the
53+
`coverage/` directory:
54+
55+
- **`coverage/lcov-report/index.html`** — Interactive HTML report (open in
56+
browser)
57+
- **`coverage/lcov.info`** — LCOV format (used by Codecov)
58+
- **`coverage/clover.xml`** — Clover XML format
59+
- **`coverage/coverage-final.json`** — JSON format
60+
61+
The HTML report provides a visual breakdown of which files are covered by tests.
62+
63+
### Codecov Integration
64+
65+
The project uses Codecov to track code coverage over time and on pull requests.
66+
67+
#### CI Integration
68+
69+
- The GitHub Actions workflow (`.github/workflows/test-deploy.yml`)
70+
automatically uploads coverage to Codecov after running tests
71+
- Coverage reports appear as comments on pull requests (if enabled)
72+
- The workflow uses `codecov/codecov-action@vxxx` (whatever version is most
73+
recent) to upload the `lcov.info` file
74+
75+
#### Configuration
76+
77+
Codecov behavior is configured in `.codecov.yml`:
78+
79+
- Patch coverage is tracked (checks coverage of changed code in PRs)
80+
- Project-level status checks are disabled
81+
- PR comments are disabled
82+
- Codecov now requires a token for all uploads so we have one generated in the
83+
repo as a secret `secrets.CODECOV_TOKEN`.
84+
85+
#### Local Usage
86+
87+
You don't need a Codecov account to view coverage locally—just run `pnpm test`
88+
and open the HTML report. Codecov integration is primarily for tracking coverage
89+
trends and to simplify PR reviews in the CI/CD pipeline.
90+
391
## Linting
492

593
2026 update: The project is now using ESLint 9 and the flat config format. As we

0 commit comments

Comments
 (0)