Skip to content

Add *.cobertura.xml to coverage file discovery patterns #795

Description

@ScarletKuro

Hi! I’d like to request adding this pattern to the default coverage file discovery list:

"*.cobertura.xml"

Current discovery includes:

"cobertura.xml"
"*coverage*.*"

but it does not include *.cobertura.xml.

This matters for .NET projects using the newer Microsoft Testing Platform v2 flow with Microsoft.Testing.Extensions.CodeCoverage. When running tests like this:

dotnet test -c Release --coverage --coverage-output-format cobertura --results-directory TestResults

Microsoft.CodeCoverage writes Cobertura reports with GUID-style filenames, for example:

TestResults/b4dc2cd6-7034-4454-b427-396a638ab386.cobertura.xml

That file is a valid Cobertura XML report, but Codecov automatic discovery misses it because:

"cobertura.xml"

only matches a file named exactly cobertura.xml, and the GUID filename does not match:

"*coverage*.*"

because it does not contain the word coverage.

The common workaround is to add a CI step that copies/renames the files:

mkdir -p coverage
i=0
for f in TestResults/*.cobertura.xml; do
  [ -e "$f" ] || continue
  i=$((i + 1))
  cp "$f" "coverage/coverage-$i.cobertura.xml"
done

This works, but it is unnecessary friction, especially as Microsoft Testing Platform v2 becomes the default path for modern .NET test projects. Multiple test projects/executables can each produce their own GUID-named .cobertura.xml report, so using one fixed output filename is not a good general solution either.

Adding *.cobertura.xml should be low risk because it matches a standard Cobertura naming convention and aligns with existing suffix-style patterns such as:

"*.lcov"
"*.gcov"
"*.clover"

Expected behavior:

Codecov automatic discovery should find files like:

TestResults/<guid>.cobertura.xml

without requiring users to rename or copy them.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions