Code coverage with Coverage.jl in vscode

Hi,
I followed the “tutorial” on https://github.com/JuliaCI/Coverage.jl

I manage to create .cov files for my local package as well as an lcov file after running the command LCOV.write("coverage-lcov.info", coverage)

Is there a way to display the report in a nice way in vscode under windows?

I have tried Coverage Gutters but it does not seem to be working. I probably don’t use it correctly…

Is there a way to render the lcov file nicely in vscode?

Thank you

3 Likes

Hey there,

Not sure if you solved your issue or not but I recently decided to do the same thing as I had codecov setup but didn’t want to have to push to github and wait for tests to run to see my code coverage, and I managed to get this working using Coverage.jl to produce a lcov.info file and use Coverage Gutters extension with it. I noticed that for Coverage Gutters the default file it looks for is “lcov.info”, so change the .info file name (call LCOV.write(“lcov.info”, coverage)) if you haven’t already.

4 Likes

I just tried Coverage.LCOV.write(filepath, coverage) does not work. Here is the complete workflow that worked for me

Julia line coverage information in VS Code

First generate .cov files:

using Pkg
Pkg.test("MyPackage"; coverage=true)

Then

using Coverage
coverage = process_folder()
open("lcov.info", "w") do io
    LCOV.write(io, coverage)
end;

Finally, open a source file in VS Code and run the command “Coverage Gutters: Display Coverage” in the VS Code Command Pallet.

2 Likes

LCOV.write(“lcov.info”, coverage)

the working call is

 LCOV.writefile(“lcov.info”, coverage)
1 Like