rcasia / neotest-java

Neotest adapter for Java.
MIT License
42 stars 23 forks source link

I cannot run the tests #127

Closed JjersaR closed 1 month ago

JjersaR commented 3 months ago

I use the LazyVim configuration with this code to neotest:

return {
  {
    "rcasia/neotest-java",
    init = function()
      -- override the default keymaps.
      -- needed until neotest-java is integrated in LazyVim
      local keys = require("lazyvim.plugins.lsp.keymaps").get()
      -- run test file
      keys[#keys + 1] = {"<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, mode = "n" }
      -- run nearest test
      keys[#keys + 1] = {"<leader>tr", function() require("neotest").run.run() end, mode = "n" }
      -- debug test file
      keys[#keys + 1] = {"<leader>tD", function() require("neotest").run.run({ strategy = "dap" }) end, mode = "n" }
      -- debug nearest test
      keys[#keys + 1] = {"<leader>td", function() require("neotest").run.run({ vim.fn.expand("%"), strategy = "dap" }) end, mode = "n" }
    end,
  },
  {
    "nvim-neotest/neotest",
    dependencies = {
      "nvim-neotest/nvim-nio",
      "nvim-lua/plenary.nvim",
      "antoinemadec/FixCursorHold.nvim",
      "nvim-treesitter/nvim-treesitter"
    },
    opts = {
      adapters = {
          ["neotest-java"] = {
            -- config here
          },
      },
    },
  },
}

When using the command: "<leader>tr", I get this error: Screenshot_23-jul_10-17-21_kitty

So far I have only added this dependency to pom.xml:

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.10.2</version>
      <scope>test</scope>
    </dependency>

In the path: .local/share/nvim/neotest-java/ has the version: junit-platform-console-standalone-1.10.1.jar /

rcasia commented 2 months ago

It would be useful to see the complete output and and to have a test sample. Could you share it, please?