Add java jacoco coverage support
This is something I pulled together in a couple hours. Only tested with a jacocoTestReport.xml file generated by the gradle plugin. Added some options to configure stuff.
Uses https://lunarmodules.github.io/luaexpat/ to parse XML. I tried to use lua-xmlreader but i could not get it to compile on my computer.
I'm leaving this PR as a draft because I don't really have the time to write the docs and make sure everything is working correctly and like up to spec, but it's functional enough that I think it's worth sharing. Hopefully I can tidy up the code a little and actually write docs once i can find some time, but if anyone feels like writing fixes and such that'd be really cool i think. I haven't seen any glaring errors tho,
(a little unrelated but i really like this plugin's approach to extensibility :saluting_face:)
I know this is an older discussion, but I'm having trouble getting this to work for myself, I've installed the plugin like this:
use({
"ColdMacaroni/nvim-coverage",
requires = "nvim-lua/plenary.nvim",
config = function()
require("coverage").setup({
commands = true,
lang = {
coverage_file = vim.fn.getcwd() .. "\\target\\site\\jacoco\\jacoco.xml"
}
})
end,
})
But when I execute :Coverage when I have a java file open it'll keep telling me Coverage report not available for filetype java
Could you help me getting set up?
Hi @BasBouwhuis-sf!
I continuated the work in #59.
Btw, your setup config should have something more like:
{
commands = true,
lang = {
java = {
dir_prefix = "src\\main\\java",
coverage_file = vim.fn.getcwd() .. "\\target\\site\\jacoco\\jacoco.xml"
}
}
}
I've been really busy with uni so I haven't been able to help debug or work on this. Thank you for picking it up!
Also, @rcasia, thank you for neotest-java! It helped me through many courses
Closing in favour of #59