question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWS CodeBuild Code Coverage supporting clover.xml

See original GitHub issue

I am using CDK to deploy a CodePipeline which then handles cross account deployments for my NodeJS Lambda. In the build stage of my CodePipeline, I would like to run unit tests and generate a code coverage report. I am using jest with the coverage flag which default creates a clover.xml for code coverage.

https://docs.aws.amazon.com/codebuild/latest/userguide/code-coverage-report.html says it supports clover.xml but I have been struggling to find a good example on how to do this, when I try to deploy my cdk pipeline stack with reports like this

          reports: {
            jest_reports: {
              files: ['reports/CodeCoverageReport.xml'],
              fileFormat: 'JUNITXML',
              baseDirectory: 'reports',
            },
            clover_reports: {
                files: ['reports/coverage/jest/clover.xml'],
                fileFormat: 'CLOVERXML',
                baseDirectory: 'reports',
            },
          },

I am getting this error:

[code_coverage_reports: [error processing report: [/codebuild/output/src245295669/src/reports/coverage/jest/clover.xml: expected element type <testsuite> but have <coverage>]]]

Is there any examples on how to do this or any advice on how to fix this?


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

8reactions
xrzhuangcommented, Mar 30, 2021

Commenting the fix here for visibility in case anyone else runs into this. What happens is the incorrect version in my original post created the report group clover_reports as a TEST report type. This is because the keys were incorrect and the default is JUNITXML. The code snippet here: https://github.com/aws/aws-cdk/issues/13867#issuecomment-810555222 is correct, all I had to do was delete the incorrectly created report group. Alternatively, one could simply rename the report group to something else.

1reaction
skinny85commented, Mar 30, 2021

Thanks for the follow up @xrzhuang!

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - AWS CodeBuild Code Coverage supporting clover.xml
I'm trying to create two report groups for test and code coverage, the test group is working fine whereas my code coverage group...
Read more >
Code coverage reports - AWS CodeBuild
Generate a code coverage report in CodeBuild. ... The following code coverage report file formats are supported: JaCoCo XML. SimpleCov JSON¹. Clover XML....
Read more >
Aws Codebuild Code Coverage Supporting Clover.Xml - ADocLib
The following code coverage report file formats are supported: JaCoCo XML.SimpleCov JSON.Clover XML.Cobertura XML.CodeBuild accepts JSON code. The Cypress code ...
Read more >
Codebuild Test Coverage with .Net Core : r/aws - Reddit
In Codebuild, test coverage supports these formats: JaCoCo XML. SimpleCov JSON. Clover XML. Cobertura XML. So it looks like cobertura is the ...
Read more >
AWS CodeBuild Report Groups 101 - YouTube
AWS CodeBuild provides a fully managed, Docker-based build environment. You can use it in standalone mode or together with CodePipeline.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found