Skip to content

Bug: Coverage not shown for subprojects in Explorer and Testing tab #1676

Closed

Description

@dishmaker

Coverage from jacoco for imported source is not being show in UI.
Only the project with unit tests is annotated with coverage percentage.
Dependency coverage is ignored in the UI.

Environment:

  • VS Code Version:1.87.0
  • Extension Version:v0.25.2023121402
  • JDK Type & Version:Eclipse Adoptium JDK 8.0.372
  • OS Type & Version: Windows

Step to Reproduce:
Set up an eclipse .project and .classpath with another project inside.

  • ./proj/src (MainProject is here)
  • ./proj/test/src (MyProject_Tests is here)

Inside (tests) project should contain .classpath with classpathentry src=/MainProject.

Run JUnit test coverage in a project MyProject_Tests which imports MainProject with:
Ctrl+Shift+P: Test: Run All Tests with Coverage

Expected Behavior:
Coverage generated for MyProject_Tests and MainProject too.

Actual Behavior:
Only MyProject_Tests coverage is shown in Explorer and Testing tab.

Note:
jacoco.exec is generated with subproject class paths. However, VSCode shows coverage only for the _Tests project.

Activity

  1. jdneo commented on Mar 27, 2024

    @jdneo
    Member

    Seems like this part of the code should be improved:

    if (entry.getEntryKind() != ClasspathEntry.CPE_SOURCE ||
    ProjectTestUtils.isTestEntry(entry)) {
    continue;

    For example, expand the classpath when it's a project/container, and persist all output -> source root relationships for those new discovered source kind entry.

  2. added a commit that references this issue on Apr 1, 2024
    99faaae
  3. jdneo commented on Apr 1, 2024

    @jdneo
    Member

    Should be fixed by 99faaae

    I'll schedule a pre-release sooner.

  4. jdneo commented on Apr 1, 2024

    @jdneo
    Member

    0.40.2024040105 is released which fixes this issue.

  5. dishmaker commented on Apr 5, 2024

    @dishmaker
    Author

    Works fine. Thanks!

  6. jlegue commented on Sep 13, 2025

    @jlegue

    This issue has been closed however, it seems to still occur in my environment running the latest VS Code:

    Version: 1.104.0 (system setup)
    Commit: f220831ea2d946c0dcb0f3eaa480eb435a2c1260
    Date: 2025-09-10T06:46:18.035Z
    Electron: 37.3.1
    ElectronBuildId: 12342881
    Chromium: 138.0.7204.235
    Node.js: 22.18.0
    V8: 13.8.258.31-electron.0
    OS: Windows_NT x64 10.0.26100

    When I run a full set of tests with coverage the Test Explorer blinks and refreshes constantly. It finally stops and it will have a subset of the full set of subprojects displayed in the Test Coverage area and will show all green checks for all the subprojects in the Test Explorer even though coverage is not shown for all subprojects. The number of tests run and shown in the Test Explorer area is also inconsistent as it will show 340+ tests and then when it is done execution it will show it complete with 184/184 or similar and the Test Coverage rarely shows all the subprojects and seemingly never has all of them showing the correct coverage numbers based on the aggragate JaCoCo report.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions