alfaix / neotest-gtest

Google Test adapter for nvim-neotest
MIT License
45 stars 14 forks source link

I need help configuring neotest with neotest-gtest #30

Open javierfileiv opened 1 week ago

javierfileiv commented 1 week ago

Hello, it's damn late where I live and the only thing that's it holding me from switching from vscode to neovim is the lack of a testing interface for GTests.

It's been a while since I search everywhere and I even posted on reddit (no one replied) and I'm wondering if someone in the website is using this plugin adapter to run GTest tests.

Could you provide me with a useful configuration please?

When I try to run a test I get always 'No test found' even if I just built my file with tests. It's not asking which file to attach to parse the test (I guess it works like that)

Well, my last bottle in the sea

Thank you very much, have a good one.

alfaix commented 6 days ago

Hello, I would need to be able to reproduce the issue to be able to help. The plugin has not been changed for a while and likely should continue to work, barring some breaking changes in neotest or nio. That makes it most likely to be a configuration issue. Could you please paste your config for neotest and neotest-gtest here?

javierfileiv commented 20 hours ago

Thanks for your help!

my config using lazy.nvim is: neoest.lua:

return {
  "nvim-neotest/neotest",
  dependencies = {
    "alfaix/neotest-gtest",
    "nvim-neotest/nvim-nio",
    "nvim-lua/plenary.nvim",
    "antoinemadec/FixCursorHold.nvim",
    "nvim-treesitter/nvim-treesitter",
  },
  opts = {
    adapters = {
      ["neotest-gtest"] = {},
      debug_adapter = "codelldb",
    },
  },
  keys = {
    { "<leader>ta", "<cmd>lua require('neotest').run.attach()<cr>", desc = "Attach to the nearest test" },
    { "<leader>tl", "<cmd>lua require('neotest').run.run_last()<cr>", desc = "Toggle Test Summary" },
    { "<leader>to", "<cmd>lua require('neotest').output_panel.toggle()<cr>", desc = "Toggle Test Output Panel" },
    { "<leader>tp", "<cmd>lua require('neotest').run.stop()<cr>", desc = "Stop the nearest test" },
    { "<leader>ts", "<cmd>lua require('neotest').summary.toggle()<cr>", desc = "Toggle Test Summary" },
    { "<leader>tt", "<cmd>lua require('neotest').run.run()<cr>", desc = "Run the nearest test" },
    {
      "<leader>tT",
      "<cmd>lua require('neotest').run.run(vim.fn.expand('%'))<cr>",
      desc = "Run test the current file",
    },
    {
      "<leader>td",
      function()
        require("neotest").run.run({ suite = false, strategy = "dap" })
      end,
      desc = "Debug nearest test",
    },
  },
}

neotest-gtest.lua:

return {
  "alfaix/neotest-gtest",
  opts = {},
}