Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty coverage report annotations when all tests pass #398

Open
MilivojRadonic opened this issue Oct 9, 2023 · 0 comments
Open

Empty coverage report annotations when all tests pass #398

MilivojRadonic opened this issue Oct 9, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@MilivojRadonic
Copy link

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

@MilivojRadonic MilivojRadonic added the bug Something isn't working label Oct 9, 2023
@MilivojRadonic MilivojRadonic changed the title Empty report when all tests pass Empty coverage report annotations when all tests pass Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants