Skip to content

No data sent to Coveralls casued by absolute paths in cobertura file #199

@Martomate

Description

@Martomate

Environment

Scala 3.2.0, sbt-scoverage 2.0.2, sbt-coveralls 1.3.2

Problem

No coverage data is sent to Coveralls

Possible cause

The cobertura.xml file contains absolute paths for the class filenames, which results in sbt-coveralls not finding any source files.

This happens on this line, where the relativePath is not relative:

This is likely caused by the new scoverage version for Scala 3, where there were some changes to the cobertura.xml file. It now starts like this:

<?xml version="1.0"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage 
line-rate="0.29" lines-valid="7499" lines-covered="2198" branches-valid="593" branches-covered="175" branch-rate="0.30" complexity="0" version="1.0" timestamp="1662191703030">
    <sources>
        <source>--source</source>
        <source>/Users/martin/git/myproject/src/main/scala</source>
    </sources>
    <packages>
        <package name="ai" line-rate="0.00" branch-rate="0.00" complexity="0">
            <classes>
                <class 
                name="a.MyClass" filename="/Users/martin/git/myproject/src/main/scala/a/MyClass.scala" line-rate="0.00" branch-rate="0.00" complexity="0">
                    <methods>
                        <method name="a/MyClass/myFunction" signature="()V" line-rate="0.00" branch-rate="0.00" complexity="0">
                            <lines>
                                <line number="17" hits="0" branch="false"/>

Metadata

Metadata

Assignees

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