Closed reganheath closed 2 years ago
@reganheath Thanks for the issue, I will try to dig into it for yeah soon.
To give you something high level to try out, I know cobertura has been annoying for some to get working, so if you are able to use lcov or clover formats for coverage instead... that would be preferable. https://github.com/ryanluker/vscode-coverage-gutters/blob/master/src/files/coverageparser.ts#L1-L4
I also found this person setup with erlang and the extension with a lcov generate they built. I am no erlang expert though so it might not work with rebar3 🤔 . https://elixirforum.com/t/lcovex-lcov-file-generator-for-elixir-projects/32057
Maybe that will help?
@ryanluker Hi, thanks. No rush on this. GitLab itself handles the coverage data, so we've got that and I can easily write a small script to clean it up for coverage gutters. Thanks!
@reganheath I might close this ticket then as eventually Cobertura will be deprecated given it isn't maintained anymore and will slowly rot... https://github.com/vokal/cobertura-parse Most of the issues that show up like this are due to bugs not being fixed in the upstream package.
We even had to pin the package to a specific commit to get what we needed 😓 . https://github.com/ryanluker/vscode-coverage-gutters/blob/master/package.json#L281
If we could find a different js / ts package for consuming Cobertura style coverage... then we should definitely switch to that!
@reganheath I believe this is fixed with https://github.com/ryanluker/vscode-coverage-gutters/pull/360 possibly. Keep an eye out for this fix in the 2.10.0 release, otherwise we can always open this ticket again if it didn't help.
@ryanluker Hi, unfortunately the bug persists in v2.10.1 unchanged (same stack, same cause, same result).
I have created a patch: https://github.com/fschwaiger/cobertura-parse/pull/1
@reganheath Thanks for the heads up! Once it is merged in the upstream repo we can update the version here, and it will go out in the next release.
@reganheath Upstream is merged, so we just need to update the commit hash, do you have an example file we can use to simulate the error and test that it has been fixed?
Any file with a package with no classes will do, e.g.
`
`
@reganheath This will be fixed in the 2.11.0 release!
@reganheath I just saw that 2.11.0 has a bunch of stuff in it already 😅 if this upcoming release ends up taking longer than a month to finish, I will do a smaller release to get this stuff out and into the marketplace store.
@reganheath sorry for the delay, 2.10.2 is going out now and includes the cobertura fix.
I have coverage gutters v2.9.1
I am generating code coverage for Erlang using rebar3, then converting the output to Cobertura using https://github.com/covertool/covertool.
The top of the stack is.. [1643108745489][coverageparser][cobertura-parse]: Stacktrace: TypeError: filename: //Dev/game/X/_build/test/covertool/X.covertool.xml Cannot read property 'lines' of undefined
at extractLcovStyleBranches (/***/.vscode-server/extensions/ryanluker.vscode-coverage-gutters-2.9.1/node_modules/cobertura-parse/source/index.js:30:12)
at //.vscode-server/extensions/ryanluker.vscode-coverage-gutters-2.9.1/node_modules/cobertura-parse/source/index.js:77:24
at Array.map (:null:null)
at unpackage (//.vscode-server/extensions/ryanluker.vscode-coverage-gutters-2.9.1/node_modules/cobertura-parse/source/index.js:75:20)
at //.vscode-server/extensions/ryanluker.vscode-coverage-gutters-2.9.1/node_modules/cobertura-parse/source/index.js:134:22
at Parser. (//.vscode-server/extensions/ryanluker.vscode-coverage-gutters-2.9.1/node_modules/xml2js/lib/parser.js:303:18)
Which, I believe, indicates that the c (class) object passed to extractLcovStyleBranches is undefined. Which seems to indicate that the array returned by classesFromPackages has included an 'undefined' element.
I checked classesFromPackages, and compared to the XML I have, which looks like (cut down, removed identifiers, etc)
If I remove all the packages with no classes, e.g.
Then it works without error.