Test coverage visualization not working in monorepo with Dind

Describe your question in as much detail as possible:

We have a monorepo with two apps, a React client and a Nodejs server. Both generate coverage reports. I am trying to setup the test coverage visualization feature for our open source project. I can see that the cobertura xml file is uploaded as an artifact for both the client and the server, however I don’t see any test coverage visualization in the diff view, another thing to note is, the testing tasks are ran with Docker-in-Docker, so perhaps the path in the cobertura report is off.

  • What are you seeing, and how does that differ from what you expect to see?
  • Consider including screenshots, error messages, and/or other helpful visuals
  • What version are you on? Are you using self-managed or GitLab.com?
    • GitLab (Hint: /help):
    • Runner (Hint: /admin/runners):

We expect to see the test coverage visualization but don’t see any in the diff view, we are using GitLab.com. You can view this MR here that ran the pipeline and you can download the two cobertura reports fix: allow multiple query params (EN-277) (!185) · Merge requests · Carleton Blueprint / beneficent · GitLab

  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

In this MR I am using sed to replace the source path so that it’s aligned with the project path structure on GitLab but still no coverage visualization: fix: use sed to fix root path (EN-321) (!186) · Merge requests · Carleton Blueprint / beneficent · GitLab

Any help would be greatly appreciated!

Fixed it! :smiley:
Adding the following script for the server service:

  after_script:
    - echo "fixing source path in cobertura report"
    - sed -i -e 's/usr\/src\/app/builds\/carletonblueprint\/beneficent\/services/' services/server/coverage/cobertura-coverage.xml
    - echo "fixing filenames in cobertura report"
    - sed -i -e 's/src/server\/src/' services/server/coverage/cobertura-coverage.xml

And the following for the client service:

  after_script:
    - echo "fixing source path in cobertura report"
    - sed -i -e 's/usr\/src\/app/builds\/carletonblueprint\/beneficent\/services/' services/client/coverage/cobertura-coverage.xml
    - echo "fixing filenames in cobertura report"
    - sed -i -e 's/src/client\/src/' services/client/coverage/cobertura-coverage.xml

Seemed to fix it, can now see the inline test coverage on this MR: fix: use sed to fix root path (EN-321) (!186) · Merge requests · Carleton Blueprint / beneficent · GitLab

1 Like