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

XML Coverage file not found #154

Closed zgoda-mobica closed 6 years ago

zgoda-mobica commented 6 years ago

My test run produces xml output in the file cov.xml and places it in workspace folder but I keep getting this error:

[gutters]: Stacktrace Error: Could not find a Coverage file!
    at FilesLoader.<anonymous> (/Users/jzgoda/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.1.0/out/src/filesloader.js:29:23)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jzgoda/.vscode/extensions/ryanluker.vscode-coverage-gutters-2.1.0/out/src/filesloader.js:4:58)
    at <anonymous>

Before I installed this extension the name of a file was coverage.xml. Got the above error, changed "coverage-gutters.xmlname" value to coverage.xml, reloaded VSCode and tried to add watch, same error. Changed name of coverage results file, removed config, reloaded VSCode, enabled watch - same error. Now the fun part begins: uninstalled extension and installed it again, enabled watch and boom, everything works.

ryanluker commented 6 years ago

@zgoda-mobica thanks for opening an issue. This is an interesting one, when you mentioned the second time around you changed name of coverage file, removed config, reloaded IDE, enabled watch did you also change the the value of xmlname to cov.xml? Good to see that it works now but definitely there is an issue here with the config loading (currently it caches the settings on load and then on some settings never refreshes the in memory ones until the IDE or extension reloads).

zgoda-mobica commented 6 years ago

No, I just removed configuration entry in workspace settings to use default.

davidbrownell commented 6 years ago

I am running into the same issue (without the part about things working after an uninstall/reinstall). In my case, I was able to root cause the problem to the glob expression on line 87 in fileLoader.js. If I change the expression from **/${fileName} to **${fileName}, things work as expected (no error message and I can see the coverage info displayed based on information in the file).

I don't know much about the glob implementation, but my guess is that this may not be the right fix as it looks like the glob docs suggest that globstar patterns represent 0 or more dirs. That pattern should should resolve to 0 dirs in this particular use case.

ryanluker commented 6 years ago

@davidbrownell thanks for the extra info, is the fix you mentioned also fixing the issue you raised #156 ? I will look into this bug for the 2.1.1 release anyways but any extra info helps :smile:

davidbrownell commented 6 years ago

Thanks for taking a look, @ryanluker. Unfortunately, this work around doesn't fix #156.

ryanluker commented 6 years ago

@zgoda-mobica going to close this issue unless it comes up again with you or someone else, thanks for submitting it though!

davidbrownell commented 6 years ago

I am still experiencing this issue with 2.1.1. Changing **/${fileName} to **${fileName} addresses the issue for me.