summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/neotest.lua
blob: 74817a50b4f224876b631b4fa95626ecfa0698ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
return {
  {
    "nvim-neotest/neotest",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-treesitter/nvim-treesitter",
      "antoinemadec/FixCursorHold.nvim",

      "nvim-neotest/neotest-python",
    },
    keys = {
      { "<leader>tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run buffer" },
      { "<leader>tT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run all files" },
      { "<leader>tr", function() require("neotest").run.run() end, desc = "Run nearest test" },
      { "<leader>td", function() require("neotest").run.run({strategy="dap"}) end, desc = "Debug nearest test" },
      { "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle summary" },
      { "<leader>to", function() require("neotest").output.open({enter=true, auto_close=true}) end, desc = "Show output" },
      { "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle output panel" },
      { "<leader>tS", function() require("neotest").run.stop() end, desc = "Stop" },
      { "<leader>twt", function() require("neotest").watch.watch(vim.fn.expand("%")) end, desc = "Watch buffer" },
      { "<leader>twT", function() require("neotest").watch.watch(vim.loop.cwd()) end, desc = "Watch all files" },
      { "<leader>twr", function() require("neotest").watch.watch() end, desc = "Watch nearest test" },
      { "<leader>tws", function() require("neotest").watch.stop() end, desc = "Stop watching" },
    },
    config = function()
      require("neotest").setup({
        adapters = {
          require("neotest-python"),
        },
      })
    end,
  },
}