npm.io
2.1.4 • Published 2 months ago

@reporters/github

Licence
MIT
Version
2.1.4
Deps
2
Size
30 kB
Vulns
0
Weekly
0
Stars
63

npm version tests codecov

GitHub Actions Annotations Reporter

Adds GitHub Actions annotations (inline error annotations and diagnostics) and a job summary to node:test — failures show up pinned to the exact line in the PR diff, listed on the workflow run, and totaled in a summary table.

This reporter emits only GitHub Actions workflow commands — it produces no human-readable test log of its own, so you pair it with another reporter (e.g. spec) for the readable output. Outside GitHub Actions it emits nothing, which means it's safe to leave in your test command everywhere: it stays completely out of the way locally.

github vs gh

  • @reporters/github (this package) — annotations and summary only. Layer it on top of whatever reporter you already use; it stays out of the way locally (no output unless running in GitHub Actions).
  • @reporters/gh — all-in-one: bundles a readable spec-style log with the annotations and summary, so you only need a single --test-reporter.

See the full comparison in the main README.

Installation

npm install --save-dev @reporters/github

or

yarn add --dev @reporters/github

Usage

# .github/workflows/test.yml
- name: Run tests
  run: node \
    --test-reporter=@reporters/github --test-reporter-destination=stdout \
    --test-reporter=spec --test-reporter-destination=stdout \
    --test

The second reporter (spec here, but any reporter works) provides the human-readable log; @reporters/github adds the annotations and summary alongside it. If you'd rather not juggle two reporters, use @reporters/gh instead.

What it looks like

When a test fails, annotations appear in the GitHub UI with the corresponding errors and diagnostics — see this example run:

Inline annotations — failures pinned to the exact line in the PR diff
Inline Annotation
Annotations on the workflow run
Annotation
Job summary — pass/fail/skip counts and durations
Summary

Keywords