rcasia / neotest-java

Neotest adapter for Java.
MIT License
38 stars 21 forks source link

ENOENT: no such file or directory on Windows #135

Open Cirius1792 opened 3 weeks ago

Cirius1792 commented 3 weeks ago

OS: Windows neovim version: 0.10.1 neotest-java version is the latest available (commit d82f3a4)

Plugin installed by using lazy with the following super minimal config:

    {
        "rcasia/neotest-java",
        ft = "java",
        init = function() end,
    },

While neotest is configured as follows:

    {
        "nvim-neotest/neotest",
        event = "LspAttach",
        -- ft = "python",
        dependencies = {
            "folke/trouble.nvim",
            "nvim-lua/plenary.nvim",
            "antoinemadec/FixCursorHold.nvim",
            "nvim-treesitter/nvim-treesitter",
            "nvim-neotest/neotest-python",
            "nvim-neotest/neotest-go",
            "rcasia/neotest-java",
        },
        config = function()
            local pythonPath
            if vim.fn.has("win32") == 1 then
                -- Set the path for Windows
                pythonPath = ".venv/Scripts/python"
            else
                -- Set the path for Linux or macOS
                pythonPath = ".venv/bin/python"
            end
            require("neotest").setup({
                adapters = {
                    require("neotest-python")({
                        dap = { justMyCode = false },
                        runner = "pytest",
                        --python = ".venv/Scripts/python",
                        python = pythonPath,
                    }),
                    require("neotest-go"),
                    require("neotest-java"),
                },
                status = { virtual_text = true },
                output = { open_on_run = true },
                --  quickfix = {
                --      open = function()
                --          require("trouble").open({ mode = "quickfix", focus = false })
                --      end,
                --  },
            })
        end,
    },

As you can see, I am also using other extensions for neotest and none of them is giving me any problem. Also, neotest-java used to work fine, then an update probably broke something, but I can't tell you much more because I didn't use it until now.

When I try to run any test in a java maven project I get the following error:

neotest-java: .../nvim-data/lazy/neotest/lua/neotest/lib/process/init.lua:41: ENOENT: no such file or directory                                                                                                                   stack traceback:                                                                                                                                                                                                                          ...older/nvim-data/lazy/neotest/lua/neotest/client/init.lua:89: in function <...older/nvim-data/lazy/neotest/lua/neotest/client/init.lua:88>                                                                                      [C]: in function 'error'                                                                                                                                                                                                          .../nvim-data/lazy/neotest/lua/neotest/lib/process/init.lua:41: in function 'run'                                                                                                                                                 ...-data/lazy/neotest-java/lua/neotest-java/command/run.lua:18: in function 'run'                                                                                                                                                 ...lazy/neotest-java/lua/neotest-java/core/spec_builder.lua:28: in function 'build_spec'                                                                                                                                          ...der/nvim-data/lazy/neotest/lua/neotest/client/runner.lua:76: in function '_run_tree'                                                                                                                                           ...der/nvim-data/lazy/neotest/lua/neotest/client/runner.lua:65: in function <...der/nvim-data/lazy/neotest/lua/neotest/client/runner.lua:22>                                                                                      
[C]: in function 'xpcall'                                                                                                                                                                                                         ...older/nvim-data/lazy/neotest/lua/neotest/client/init.lua:84: in function 'run_tree'                                                                                                                                            ...der/nvim-data/lazy/neotest/lua/neotest/consumers/run.lua:85: in function 'func'                                                                                                                                                ...g_alias_folder/nvim-data/lazy/nvim-nio/lua/nio/tasks.lua:173: in function <...g_alias_folder/nvim-data/lazy/nvim-nio/lua/nio/tasks.lua:172>      

image

It seems the same error was reported here https://github.com/nvim-neotest/neotest/issues/268 is there a way to implement a solution similar to the one suggested in the issue to point directly to a .CMD file?

rcasia commented 1 week ago

Could you try it again with the last updates, please?

If it still throws an error follow these steps:

  1. Delete ~/AppData/Local/nvim-data/neotest-java.log and ~/AppData/Local/nvim-data/neotest.log
  2. Try to run tests again
  3. Share those files
Cirius1792 commented 1 week ago

Still not working but slightly different error: First time running tests: image Trying to rerun the tests immediately after the previous error: image Trying to run the tests again leads to no output at all, having neotest stucked where it seems to be endlessly execute the tests.

Here's the log: neotest.log neotest-java.log

It seems to me that there is a missing file: target\neotest-java\cp_arguments.txt