my neovim config, who would've thought
1---@type LazySpec
2return {
3 "nvim-neotest/neotest",
4 keys = function()
5 local function wrap(first, second, args)
6 args = args or nil
7 return function()
8 return require("neotest")[first][second](args)
9 end
10 end
11
12 return {
13 { "<leader>tn", wrap("run", "run") },
14 {
15 "<leader>tt",
16 function()
17 require("neotest").run.run(vim.fn.expand "%")
18 end,
19 },
20 { "<leader>tS", wrap("run", "stop") },
21 { "<leader>to", wrap("output", "open") },
22 { "<leader>ts", wrap("summary", "toggle") },
23 { "<leader>tw", wrap("watch", "toggle") },
24 { "]t", wrap("jump", "next") },
25 { "[t", wrap("jump", "prev") },
26 { "]T", wrap("jump", "next", { status = "failed" }) },
27 { "[T", wrap("jump", "prev", { status = "failed" }) },
28 }
29 end,
30 dependencies = {
31 "nvim-neotest/nvim-nio",
32 { "fredrikaverpil/neotest-golang", version = "v1" },
33 "nvim-treesitter",
34 },
35 config = function()
36 vim.diagnostic.config({
37 virtual_text = {
38 format = function(diagnostic)
39 local r, _ = diagnostic.message
40 :gsub("\n", " ")
41 :gsub("\t", " ")
42 :gsub("%s+", " ")
43 :gsub("^%s+", "")
44 return r
45 end,
46 },
47 }, vim.api.nvim_create_namespace "neotest")
48
49 ---@type neotest.Config
50 ---@diagnostic disable-next-line: missing-fields
51 require("neotest").setup {
52 adapters = {
53 require "neotest-golang" {
54 go_test_args = { "-count=1", "-timeout=60s" },
55 testify_enabled = true,
56 },
57 },
58 discovery = {
59 enabled = true,
60 concurrent = 0,
61 },
62 running = { concurrent = true },
63 icons = {
64 expanded = "",
65 child_prefix = "",
66 child_indent = "",
67 final_child_prefix = "",
68 non_collapsible = "",
69 collapsed = "",
70 passed = "",
71 running = "",
72 failed = "",
73 unknown = "",
74 },
75 ---@diagnostic disable-next-line: missing-fields
76 summary = {
77 animated = false,
78 ---@diagnostic disable-next-line: missing-fields
79 mappings = {
80 expand = { "l", "h", "<CR>" },
81 stop = "s",
82 },
83 },
84 }
85 end,
86}