Skip to content

Report test results & coverage in the CI run summary - #96

Merged
jstayton merged 1 commit into
developmentfrom
report-test-coverage
Aug 27, 2026
Merged

jstayton merged 1 commit into
developmentfrom
report-test-coverage

Conversation

@jstayton

Copy link
Copy Markdown
Contributor

npm test -- --ci --coverage already ran in CI and both reports were already
uploaded as artifacts, so the numbers were only visible by downloading an
artifact or scrolling the job log. This posts them to the run summary, in the
same shape as the jobs in vision-download and
TRUEPIC/webhook-verifier-nodejs#46.

No thresholds. Reported, not enforced.

Matching webhook-verifier-nodejs#46: a separate job, run once on 26.x rather
than across the 22/24/26 matrix so the run gets one summary rather than three,
and set -o pipefail because npm test | tee returns tee's status, not
Jest's — without it the job reports green on a broken suite. Lint & test is
untouched, and the per-Node-version artifacts still come from there, so this
job only writes the summary.

One deliberate difference from #46, which combines the run and the report into
a single step: because the default shell is bash -e, a failing suite aborts
that step before the summary block runs, so no summary is written. Splitting
the report into its own step with if: ${{ !cancelled() }} means it is still
written when tests fail — which is when the test results are the most worth
reading. Verified both ways. #46 has the same gap and may want the same split,
since its spec reporter output is also only in the job log.

Rendered summary:

## Tests

Test Suites: 21 passed, 21 total
Tests:       357 passed, 357 total
Snapshots:   0 total
Time:        1.646 s

## Test coverage

------------------------------------|---------|----------|---------|---------|
File                                | % Stmts | % Branch | % Funcs | % Lines |
------------------------------------|---------|----------|---------|---------|
All files                           |     100 |      100 |     100 |     100 |
...

🤖 Generated with Claude Code

The suite already ran with coverage and uploaded both reports as
artifacts, so the numbers were only visible by downloading an artifact or
scrolling the job log. This posts them to the run summary instead, in the
same shape as the jobs in vision-download and webhook-verifier-nodejs.

The job runs once on 26.x rather than across the 22/24/26 matrix, so the
run gets one summary rather than three, and `Lint & test` is untouched.
Artifacts still come from that job, per Node version, so this one only
writes the summary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jstayton
jstayton merged commit 99c2a9f into development Aug 27, 2026
5 checks passed
@jstayton
jstayton deleted the report-test-coverage branch August 27, 2026 16:40
jstayton added a commit to TRUEPIC/webhook-verifier-nodejs that referenced this pull request Aug 27, 2026
The coverage job ran the tests and reported only coverage, so the test
results stayed in the job log. Node prints its own summary block right
before the coverage report, so surfacing it costs one more `grep`.

Reporting now happens in its own step. The default shell is `bash -e`, so
`set -o pipefail` made a failing suite abort the step before it wrote the
summary — the run lost both the results and the coverage report at the
one moment they were most worth reading. Node emits both even when tests
fail, so `if: ${{ !cancelled() }}` is enough to keep them.

This matches the shape of the job in queryql:
TRUEPIC/queryql#96

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant