Skip to content

Conversation

ColdMacaroni
Copy link

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 🫡)

This is something I pulled together in a couple hours. Only tested with
jacocoTestReport.xml files 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-xml reader but i could /not/ get it to compile on my computer.

I am a little shaky on some of the terminology but it works for me so i
thought i'd share.
@BasBouwhuis-sf
Copy link

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?

@rcasia
Copy link
Contributor

rcasia commented Sep 27, 2024

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"
                }
            }
}

@ColdMacaroni
Copy link
Author

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

@ColdMacaroni
Copy link
Author

Closing in favour of #59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants