CodeCoverageSummary icon indicating copy to clipboard operation
CodeCoverageSummary copied to clipboard

How to get coverage per file

Open michelkok opened this issue 1 year ago • 10 comments

Please, can you help me find how I can get more detailed information in the report? image

I use Coverage.py to generate the coverage.cobertura.xml file which does actually contain the information per file in the directory not just the overall score. image

This is part of my Github Actions setup:

      - name: Test docker
        run: |
          docker run \
          --rm --volumes-from github_runner \
          ${{ env.TEST_TAG }} \
          /bin/bash -c \
          "python -m coverage run --data-file=/cov/.coverage --branch -m pytest; python -m coverage xml --data-file=/cov/.coverage -o ${RUNNER_WORKDIR}/cov/coverage.cobertura.xml"

      - name: Copy files to workdir
        run: |
          cp ${RUNNER_WORKDIR}/cov/coverage.cobertura.xml ${GITHUB_WORKSPACE}/coverage.cobertura.xml

      - name: Code Coverage Report
        uses: irongut/[email protected]
        with:
          filename: coverage.cobertura.xml
          badge: true
          fail_below_min: false
          format: markdown
          hide_branch_rate: false
          hide_complexity: true
          indicators: true
          output: both
          thresholds: '60 80'

Maybe I'm just missing something simple but it seems the docs are not really stating how to do this and from the issues it seems people are able to get them, so how would I have to change my setup?

michelkok avatar Nov 07 '23 15:11 michelkok

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days.

github-actions[bot] avatar Feb 06 '24 01:02 github-actions[bot]

No, don't close, there is clearly more interest than just me without any response.

michelkok avatar Feb 06 '24 08:02 michelkok

Also experiencing this with Node.js and the cobertura output of c8. The c8 command outputs per-file coverage and the xml definitely contain per-file coverage as classes but code-coverage-summary only prints per-folder coverage.

jkcdarunday avatar Feb 13 '24 01:02 jkcdarunday