Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,27 @@ jobs:
cache: 'npm'
- name: Install npm dependencies
run: npm install
- name: Report coverage
- name: Run tests
run: |
set -o pipefail
npm run test:coverage | tee "$RUNNER_TEMP/coverage.txt"
npm run test:coverage | tee "$RUNNER_TEMP/tests.txt"
# Reported in its own step so the summary is still written when the suite
# fails, which is when the test results are most worth reading. Node
# prints both its summary and the coverage report even on failure.
- name: Report test results & coverage
if: ${{ !cancelled() }}
run: |
{
echo '## Tests'
echo
echo '```'
grep -E '^ℹ (tests|suites|pass|fail|cancelled|skipped|todo|duration_ms) ' "$RUNNER_TEMP/tests.txt" | sed 's/^ℹ //'
echo '```'
echo
echo '## Test coverage'
echo
echo '```'
awk '/start of coverage report/{f=1;next} /end of coverage report/{f=0} f' "$RUNNER_TEMP/coverage.txt" | sed 's/^ℹ //'
awk '/start of coverage report/{f=1;next} /end of coverage report/{f=0} f' "$RUNNER_TEMP/tests.txt" | sed 's/^ℹ //'
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ code in this repository.
- `npm test -- --watch` — re-run tests on file change.
- `npm run test:coverage` — run the suite with coverage, printing a report and
writing `coverage/lcov.info`. CI runs this in a separate job that posts the
report to the run summary and uploads it as an artifact. There is no
threshold: coverage is reported, not enforced.
test results and coverage report to the run summary and uploads the report as
an artifact. There is no threshold: coverage is reported, not enforced.
- `node --test src/main.test.js` — run a single test file. Add
`--test-name-pattern '<regex>'` to filter by test name.
- `npm run lint` — Prettier format check + ESLint. `npm run lint:format:fix` and
Expand Down