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
460 stars 88 forks source link

Error Could not find a Coverage file! #254

Closed valerierose closed 4 years ago

valerierose commented 4 years ago

Describe the bug I have coverage.xml in my root folder and neither changing the setting nor symlinking cov.xml to coverage.xml will pick it up. No matter what I try, I get the error:

[1581480631693][gutters]: Stacktrace Error: Could not find a Coverage file!
    at FilesLoader.<anonymous> (/Users/val/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.4.3/out/src/files/filesloader.js:32:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/val/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.4.3/out/src/files/filesloader.js:4:58)

To Reproduce Steps to reproduce the behaviour:

  1. Installed the extension
  2. Change Xmlname to coverage.xml (OR reset the setting and symlink coverage.xml to cov.xml)
  3. Select Display Coverage from the command palette
  4. See error in the output console

Expected behaviour The xml file should load and I should see coverage gutters.

Desktop (please complete the following information):

Additional Context The first few lines of my coverage file are:

<?xml version="1.0" ?>
<coverage branch-rate="0" branches-covered="0" branches-valid="0" complexity="0" line-rate="0.06729" lines-covered="94" lines-valid="1397" timestamp="1553549601089" version="4.5.2">
    <!-- Generated by coverage.py: https://coverage.readthedocs.io -->
    <!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
    <sources/>
    <packages>
        <package branch-rate="0" complexity="0" line-rate="0.07692" name=".Users....
ryanluker commented 4 years ago

@valerierose Thank you for submitting an issue! This might be an issue with using the old config setting for xmlname. Can you switch to using the new config setting and seeing if that fixes anything?

    "coverage-gutters.coverageFileNames": [
        "lcov.info",
        "ADDFILENAMEHERE.xml",
        "coverage.xml",
        "jacoco.xml"
    ],

https://webmshare.com/play/RyoPE

spottedmahn commented 4 years ago

my co-worker had "coverage-gutters.manualCoverageFilePaths": ["build/reports/jacoco/test/jacocoTestReport.xml"], and it worked for him but not me.

image

I added "jacocoTestReport.xml" to "coverage-gutters.coverageFileNames" and I was in business, thanks!

I'm on WSL, he's on Linux, maybe that's why? Maybe different versions of the extension? 🤷‍♂️

ryanluker commented 4 years ago

@spottedmahn thanks for the extra info! manualCoverageFilePaths is a last resort feature to allow developers to explicitly define an absolute path to their coverage files. coverageFileNames has a lot more smarts for finding any coverage file with a given name for all open workspaces.

spottedmahn commented 4 years ago

coverageFileNames has a lot more smarts for finding any coverage file with a given name for all open workspaces.

gotcha, so my co-worker is wrong 😜

is this documented in a wiki or readme? happy to contribute to the docs. thanks for creating the great extension!!

ryanluker commented 4 years ago

@spottedmahn it is vaguely mentioned in the package.json (which shows up in the editor UI) but adding to the tips and tricks section on the readme would be great!

ryanluker commented 4 years ago

@valerierose going to close this issue for now but more then willing to open again if you can try out https://github.com/ryanluker/vscode-coverage-gutters/issues/254#issuecomment-590129412 and let me know if that helps

kid1412621 commented 10 months ago

@valerierose Thank you for submitting an issue! This might be an issue with using the old config setting for xmlname. Can you switch to using the new config setting and seeing if that fixes anything?

    "coverage-gutters.coverageFileNames": [
        "lcov.info",
        "ADDFILENAMEHERE.xml",
        "coverage.xml",
        "jacoco.xml"
    ],

https://webmshare.com/play/RyoPE

Hi, could you add jacocoTestReport.xml into default settings? since it's default name for gradle + jacoco set up.

ryanluker commented 10 months ago

@valerierose Thank you for submitting an issue! This might be an issue with using the old config setting for xmlname. Can you switch to using the new config setting and seeing if that fixes anything?

    "coverage-gutters.coverageFileNames": [
        "lcov.info",
        "ADDFILENAMEHERE.xml",
        "coverage.xml",
        "jacoco.xml"
    ],

https://webmshare.com/play/RyoPE

Hi, could you add jacocoTestReport.xml into default settings? since it's default name for gradle + jacoco set up.

For sure we can add more defaults, we just need the exact name and a PR similar to this one https://github.com/ryanluker/vscode-coverage-gutters/pull/429