MishaKav / pytest-coverage-comment

Comments a pull request with the pytest code coverage badge and full report
MIT License
181 stars 60 forks source link

Error: Generating coverage report. Cannot destructure property 'name' of 'item' as it is null. #64

Closed colin99d closed 2 years ago

colin99d commented 2 years ago

I am trying to add this coverage checker to our large repository. There seems to be an issue creating the proper coverage report.

Screen Shot 2022-04-26 at 7 20 03 AM

I modified our Github Actions workflow to show everything being exported. The link to the issue is here: https://github.com/OpenBB-finance/OpenBBTerminal/runs/6174383671?check_suite_focus=true

Screen Shot 2022-04-26 at 7 20 40 AM

The above 4 sections show the tests ran, then the two desired output files, then show this coverage reporter which is currently failing.

MishaKav commented 2 years ago

Thank you for the great example. I fixed a bug. You can just run MishaKav/pytest-coverage-comment@main or use MishaKav/pytest-coverage-comment@v1.1.27` Please update me if it works now, I didn't test my plugin on such big repos. Thank you.

colin99d commented 2 years ago
Screen Shot 2022-04-26 at 3 06 36 PM

Thanks for the quick response! The report now runs error-free; however, it does not show the individual breakdown for files. Is this something that can be fixed or is our repository just too large?

MishaKav commented 2 years ago

can you please provide me the content of pytest-coverage.txt?

MishaKav commented 2 years ago

I see the problem, you set this setting: report-only-changed-files: true so in such case, it will show in the table only the changed files, in your commit, I saw that you changed only the readme file, so it didn't has any files to put in the table.

colin99d commented 2 years ago

I see!! Thanks for the help MishaKav! This repo is super useful.

MishaKav commented 2 years ago

GlaThank you, glad to hear that, it was the purpose of the action ) I have the same action for jest (tests for node/javascript)

MishaKav commented 2 years ago

@colin99d after your confusion, I release a feature that will give an indication for this.

image

You can just run MishaKav/pytest-coverage-comment@main or use MishaKav/pytest-coverage-comment@v1.1.28

colin99d commented 2 years ago

Awesome! I got one more issue for you that relates.

Screen Shot 2022-04-26 at 5 37 27 PM

On the PR I have been talking about we changed two files with less than 100% code coverage to test (fa_controller.py and loggers.py). However, these are not showing up in the coverage report. It was working fine on a smaller repo, so I believe this a is a large repo glitch again.

Screen Shot 2022-04-26 at 5 38 49 PM
MishaKav commented 2 years ago

As I see on your commit f80c0b4 you changed only test.yml file. It takes the changes from the commit and not full PR (maybe I can get all changed files from PR, need to check it)

You always can check it on the action itself.

image
MishaKav commented 2 years ago

@colin99d I checked this again when your action runs on push it will contain only changed files that belong to this commit. When you will run on the pull_request event, it will report tall files that changed on the full PR.

colin99d commented 2 years ago

I see. I tried just removing report-only-changed-files: true and now it only shows the failure in coverage for one file and not all of them.