ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
464 stars 90 forks source link

Support coverage reports with multiple sources #422

Closed Lucas-Steinmann closed 1 year ago

Lucas-Steinmann commented 1 year ago

Is your feature request related to a problem? Please describe. My coverage reports (generated by pytest-cov) have multiple <source> nodes, since I have a mono repository with multiple sub projects. E.g.

    <sources>
        <source>/workspace/common/src/</source>
        <source>/workspace/liba/src/</source>
    </sources>

This is achieved by adding multiple --cov= arguments to pytest.

VSCode Coverage gutters only considers the first source and does not display gutters for files belonging to other sources. The log does not show any errors either.

I can validate this when swapping the order of the sources (which is somewhat tiresome).

Describe the solution you'd like Search all <source> for each package/class.

Describe alternatives you've considered Display a warning, that this is not supported.

Additional context

Showing a coverage report does not work either, but I'm not sure if this is related.

Thank you for your work on this extension.

Lucas-Steinmann commented 1 year ago

I found a workaround.

I specified the root folder of the repository with a single --cov= instead of the library folders. Then I added all directories, which should be ignored to the pyproject.toml in the root folder:

[tool.coverage.run]
omit = ['*/tests/*']

Alternatively, you can also use .coveragerc:

[run]
omit = ['*/tests/*']
ryanluker commented 1 year ago

@Lucas-Steinmann Thanks for the ticket and good to hear you figured out a workaround. The extension leverages nodejs modules that consume different types of lcov files and more than likely multiple source support would have to be implemented there instead 🤔.