aboutsummaryrefslogtreecommitdiffstats
path: root/lua/plugins/neotest.lua
blob: e953dae892c011853d03aeabd66337c38bee054a (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
return {
  "nvim-neotest/neotest",
  enabled = true,
  keys = { { "<c-t>", desc = "Open Test menu" } },
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-treesitter/nvim-treesitter",
    "nvim-neotest/neotest-go",
    "nvim-neotest/neotest-plenary",
    "nvim-neotest/neotest-vim-test",
    "anuvyklack/hydra.nvim",
    "nvim-neotest/neotest-python",
  },
  config = function()
    local neotest = require "neotest"
    neotest.setup {
      adapters = {
        ["neotest-python"] = {
          -- Here you can specify the settings for the adapter, i.e.
          -- runner = "pytest",
          -- python = ".venv/bin/python",
        },
        require "neotest-go",
        require('rustaceanvim.neotest'),
        require "neotest-plenary",
        -- require "neotest-vim-test" {
        --   ignore_file_types = { "go", "lua", "rust", "php" },
        -- },
        -- require("laravel.neotest"),
      },
      library = { plugins = { "neotest" }, types = true },
    }

    local hydra = require "hydra"

    local hint = [[
         NeoTest
         _n_: Near test  _f_: Current file _l_: Last Test _m_: Run Marked _s_: Toggle Summary ^
         ^ ^                                            _<Esc>_
        ]]

    hydra {
      name = "neotest",
      hint = hint,
      mode = "n",
      config = {
        color = "teal",
        invoke_on_body = true,
        hint = {
          border = "rounded",
          position = "bottom",
        },
      },
      body = "<C-t>",
      heads = {
        { "n", neotest.run.run },
        {
          "f",
          function()
            neotest.run.run(vim.fn.expand "%")
          end,
        },
        { "l", neotest.run.run_last },
        { "m", neotest.summary.run_marked },
        { "s", neotest.summary.toggle },
        { "<Esc>", nil, { exit = true } },
      },
    }
  end,
}