Skip to content

Add SimpleCov for code coverage

Anatoli Babenia requested to merge abitrolly/gitlab-docs:codecov into main

What does this MR do and why?

I wanted to see if the code in lib/tasks/release.rake is covered by tests.

!3098 (diffs, comment 1124641964)

This MR adds coverage collection and reporting for Ruby tests following https://docs.gitlab.com/ee/ci/pipelines/settings.html#merge-request-test-coverage-results

Also enables coverage visualization according to https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html

Screenshots, screen recordings, or links to review app

rspec doesn't report coverage stats currently - https://gitlab.com/abitrolly/gitlab-docs/-/jobs/3130150611

image

With this MR coverage is reported in terminal - https://gitlab.com/abitrolly/gitlab-docs/-/jobs/3133678526

image

And in the MR widget.

image

And in Repository Analytics as explained here https://docs.gitlab.com/ee/ci/pipelines/settings.html#merge-request-test-coverage-results

image

Should enable diff annotation with coverage info according to https://docs.gitlab.com/ee/ci/testing/test_coverage_visualization.html

How to set up and validate locally

  1. Open this MR in Gitpod
  2. Run rspec

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Anatoli Babenia

Merge request reports