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

PRs that don't change tests showing a change in coverage #369

Open
carusooo opened this issue Apr 29, 2023 · 1 comment
Open

PRs that don't change tests showing a change in coverage #369

carusooo opened this issue Apr 29, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@carusooo
Copy link

Describe a bug

PRs that don't change tests at all are showing a change in coverage.

  1. I make a change to a README.md file
  2. Upload the PR
  3. The coverage shows changes between 2-15%

Expected behavior

No changes to coverage should be displayed.

Details

  • Action version: v2

  • OS: linux

  • action.yml file
    name: Pull Request - Backend
    on:
      pull_request:
        paths:
          - "backend/**"
    
    defaults:
      run:
        working-directory: backend
    
    jobs:
      lint-and-test:
        runs-on: ubuntu-20.04
        env:
          MODE: CI
    
        steps:
          - name: checkout
            uses: actions/checkout@v2
    
          - name: install node.js
            uses: actions/setup-node@v1
            with:
              node-version: 16.x
    
          - name: install node packages
            run: npm install
    
          - name: run lint
            run: npm run lint
    
          - uses: ArtiomTr/jest-coverage-report-action@v2
            id: coverage
            with:
              working-directory: backend
              github-token: ${{ github.token }}
              output: report-markdown
              annotations: none
          - uses: marocchino/sticky-pull-request-comment@v2
            with:
              message: ${{ steps.coverage.outputs.report }}
    
          - name: ensure clean working directory
            run: |
              rm report.json
              if files=$(git ls-files --exclude-standard --others --modified) && [[ -z "$files" ]]; then
                exit 0
              else
                echo ""
                echo "Working directory has been modified:"
                echo ""
                git status --short
                echo ""
                exit 1
              fi
      build:
        runs-on: ubuntu-20.04
        steps:
          - name: checkout
            uses: actions/checkout@v2
    
          - name: install node.js
            uses: actions/setup-node@v1
            with:
              node-version: 16.x
    
          - name: install node packages
            run: npm install
    
          - name: run build
            run: npm run build        
  • Screenshots

    Coverage report for backend

    St.
    Category Percentage Covered / Total
    🔴 Statements
    45.89% (+8.99% 🔼)
    1241/2704
    🔴 Branches
    32% (+14.1% 🔼)
    136/425
    🔴 Functions
    36.25% (+4.42% 🔼)
    141/389
    🔴 Lines
    44.99% (+2.05% 🔼)
    1154/2565

    Test suite run success

    88 tests passing in 27 suites.

    Report generated by 🧪jest coverage report action from 68938ffdb6cf7e29a6cef298820e83482370bb2a

Additional context

The above output is generated based on a change to a README.md file (not used in tests). The repository uses squash-merge commits.

@carusooo carusooo added the bug Something isn't working label Apr 29, 2023
@ArtiomTr
Copy link
Owner

ArtiomTr commented May 2, 2023

Hello @carusooo 👋,

I am unable to reproduce this issue. Could you please provide a minimal reproduction repository? This would significantly help with the debugging process.

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