Summary output for rake coverband:coverage
bessey opened this issue · 4 comments
Is your feature request related to a problem? Please describe.
I want to automate capturing the code coverage our E2E test suite reaches. We are successfully using Coverband to do that, however I would like to automate the process of reading the total % coverage currently done by a human via the web view.
Describe the solution you'd like
I see there is already a rake coverband:coverage
however the output is very low level. I can understand that that is desirable, but I wonder if it might be prepended/appended with similar output to the web, e.g.
All Files (98.76% covered at 123.45 hits/line)
/api/config/initializers/active_job.rb: [8, 8, 8, 8, 8, nil, 8, 3, nil, nil, nil, nil, nil, 8, nil, 8, 2, 2, 2, 2, 404, 404, 2020, nil, 2020, nil, nil, nil, nil, 2, 2, 2, nil, nil, 2, nil, nil, 8, 6, nil, nil, 8, nil, 8, 95, 89, nil, nil, nil, 8, 8, nil]
...
Describe alternatives you've considered
I've tried to work through the control flow of how this summary number is generated on the HTML side, to just do via a rails runner
but it's proven pretty complicated.
OK, so you basically want to get the summary information about the rollup of the totals that the web views have as part of the console output?
hey sorry @bessey this just totally got lost in my stack.. but I have added the summary data you would like... Let me know if you want any other calculations or summary data added as well.
danmayer@dellstation:~/projects/coverband_rails_example$ bundle exec rake coverband:coverage
I, [2024-04-29T23:38:23.735801 #501133] INFO -- : total_files: 23
I, [2024-04-29T23:38:23.736934 #501133] INFO -- : lines_of_code: 146
I, [2024-04-29T23:38:23.736975 #501133] INFO -- : lines_covered: 129
I, [2024-04-29T23:38:23.737120 #501133] INFO -- : lines_missed: 17
I, [2024-04-29T23:38:23.737414 #501133] INFO -- : covered_percent: 88.35616438356165
I, [2024-04-29T23:38:23.737530 #501133] INFO -- : /home/danmayer/projects/coverband_rails_example/config/environment.rb: [nil, 52, nil, nil, 52]
I, [2024-04-29T23:38:23.737569 #501133] INFO -- : /home/danmayer/projects/coverband_rails_example/config/environments/development.rb: [11, nil, 11, nil, nil, nil, nil, nil, 11, nil, nil, nil, nil, nil, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, nil, 11, 0, 0, nil, 0, 0, nil, nil, nil, 11, nil, 11, nil, nil, nil, 11, nil, nil, 11, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, 11, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 11, nil]
I, [2024-04-29T23:38:23.737587 #501133] INFO -- : /home/danmayer/projects/coverband_rails_example/config/initializers/assets.rb: [nil, nil, nil, 52, nil, nil, nil, nil, nil, nil, nil, nil]
I, [2024-04-29T23:38:23.737604 #501133] INFO -- : ...
This will go out in the next release closing.