Code coverage with Coverage.jl in vscode

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.

4 Likes