Skip to content

fix(batch): classify RequestTimeoutError as timeout in --all --wait fan-out #179

fix(batch): classify RequestTimeoutError as timeout in --all --wait fan-out

fix(batch): classify RequestTimeoutError as timeout in --all --wait fan-out #179

Workflow file for this run

name: Test Coverage
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main, dev, stg]
permissions:
contents: read
pull-requests: write
jobs:
coverage:
name: Coverage (>= 80%)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 22
cache: 'npm'
- run: npm ci
- name: Run unit tests with coverage
run: npm run test:coverage
env:
CI: true
- name: Enforce 80% line coverage minimum
run: |
if [ -f coverage/coverage-summary.json ]; then
LINES_PCT=$(jq -r '.total.lines.pct' coverage/coverage-summary.json)
echo "Line coverage: ${LINES_PCT}%"
if (( $(echo "$LINES_PCT < 80" | bc -l) )); then
echo "::error::Line coverage ${LINES_PCT}% is below the 80% minimum threshold"
exit 1
fi
else
echo "::error::Coverage report not generated"
exit 1
fi
- name: Generate Coverage Summary
id: coverage-summary
if: always()
run: |
if [ -f coverage/coverage-summary.json ]; then
TOTAL_LINES=$(jq -r '.total.lines.pct' coverage/coverage-summary.json)
TOTAL_STATEMENTS=$(jq -r '.total.statements.pct' coverage/coverage-summary.json)
TOTAL_FUNCTIONS=$(jq -r '.total.functions.pct' coverage/coverage-summary.json)
TOTAL_BRANCHES=$(jq -r '.total.branches.pct' coverage/coverage-summary.json)
{
echo "## Test Coverage Report"
echo ""
echo "| Metric | Coverage |"
echo "|--------|----------|"
echo "| Lines | ${TOTAL_LINES}% |"
echo "| Statements | ${TOTAL_STATEMENTS}% |"
echo "| Functions | ${TOTAL_FUNCTIONS}% |"
echo "| Branches | ${TOTAL_BRANCHES}% |"
} | tee -a "$GITHUB_STEP_SUMMARY" > coverage-report.md
echo "coverage_generated=true" >> "$GITHUB_OUTPUT"
else
echo "## Coverage Report Not Available" >> "$GITHUB_STEP_SUMMARY"
echo "Coverage data was not generated. Check the test run for errors." >> "$GITHUB_STEP_SUMMARY"
echo "coverage_generated=false" >> "$GITHUB_OUTPUT"
fi
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
if: github.event_name == 'pull_request' && steps.coverage-summary.outputs.coverage_generated == 'true'
with:
recreate: true
path: coverage-report.md
continue-on-error: true