Skip to content

[XML] Codecov.io does not see files with package mismatch #260

Open
@IgnatBeresnev

Description

@IgnatBeresnev

If you have a Kotlin file with some classes/functions under a certain package, for example

src/main/kotlin/org/jetbrains/kover/reproducer/PackageMismatchFile.kt

but inside the file you have a different package declared, for example

package org.jetbrains.kover.reproducer.some.inner.pckg // some.inner.pckg has been added

class PackageMismatchClass {}

codecov.io will not see (and thus not calculate coverage for) this file. You can observe it in this report.

If you physically move the file to the "correct" package, it will work as expected.

The problem might be relevant for other tools that use Jacoco format since this behaviour is not possible in Java (package must match location), and tools that analyze Jacoco coverage reports might rely on that.


I haven't noticed any difference in generated XML reports between Jacoco and IntelliJ engines, both generate the following paths:

    <package name="org/jetbrains/kover/reproducer/some/inner/pckg">
        <class name="org/jetbrains/kover/reproducer/some/inner/pckg/PackageMismatchClass"
               sourcefilename="PackageMismatchFile.kt">
            ...
        </class>
        <sourcefile name="PackageMismatchFile.kt">
            ...
        </sourcefile>
        ...
    </package>

Runnable reproducer can be found in this repo, there are instructions on how to run it and upload the report.

This was found while investigating #16

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions