ArtiomTr / jest-coverage-report-action

Track your code coverage in every pull request.

Home Page:https://www.covbot.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty coverage report annotations when all tests pass

MilivojRadonic opened this issue · comments

Describe a bug

I have written a script that runs my unit tests and publishes coverage.
When the test fails it generates coverage annotations and in it points of the crash and uncovered lines.
The problem is when tests pass, it generates empty coverage annotations without uncovered lines.

Expected behavior

I would expect that Coverage report annotations would include uncovered lines when "Run tests" step is successful.

Details

name: Unit Tests

on:
 pull_request:
   branches:
     - develop
     - stage
     - main
 workflow_dispatch:

jobs:
 test:
   permissions:
     contents: read
     pull-requests: write
     checks: write
   runs-on: ubuntu-latest
   steps:
     - name: Checkout code
       uses: actions/checkout@v3

     - name: Setup Node.js
       uses: actions/setup-node@v2
       with:
         node-version: '>=18.15.0'

     - name: Install dependencies
       run: npm ci

     - name: Run build
       run: npm run build

     - name: Run tests
       id: test-step
       run: npm run test:ci
       continue-on-error: true

     - name: Display coverage
       if: always()
       uses: ArtiomTr/jest-coverage-report-action@v2
       with:
         github-token: ${{ secrets.GITHUB_TOKEN }}
         coverage-file: report.json
         base-coverage-file: report.json
         skip-step: all
         annotations: all

     - name: Check test results
       if: steps.test-step.outcome == 'failure'
       run: exit 1

Screenshot of the result:

Screenshot 2023-10-09 at 10 55 53