-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathntest.lua
More file actions
115 lines (103 loc) Β· 2.45 KB
/
ntest.lua
File metadata and controls
115 lines (103 loc) Β· 2.45 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
local M = {}
M.config = function()
local status_ok, nt = pcall(require, "neotest")
if not status_ok then
return
end
local namespace = vim.api.nvim_create_namespace "neotest"
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
return diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
end,
},
}, namespace)
local opts = {
running = {
concurrent = false,
},
status = {
virtual_text = true,
signs = false,
},
strategies = {
integrated = {
width = 180,
},
},
discovery = {
enabled = true,
},
diagnostic = {
enabled = true,
},
icons = {
running = require("user.lsp_kind").icons.clock,
},
floating = {
border = { "β", "β", "β", "β", "β", "β", "β", "β" },
},
adapters = {
require "neotest-rust",
require "neotest-go" {
experimental = {
test_table = true,
},
},
require "neotest-python" {
dap = { justMyCode = false, console = "integratedTerminal" },
},
require "neotest-plenary",
require "neotest-zig" {
dap = {
adapter = "lldb",
},
},
},
}
if lvim.builtin.task_runner == "overseer" then
opts.consumers = {
overseer = require "neotest.consumers.overseer",
}
opts.overseer = {
enabled = true,
force_default = true,
}
end
nt.setup(opts)
end
M.get_env = function()
local env = {}
for _, file in ipairs { ".env" } do
if vim.fn.empty(vim.fn.glob(file)) ~= 0 then
break
end
for _, line in ipairs(vim.fn.readfile(file)) do
for name, value in string.gmatch(line, "(.+)=['\"]?(.*)['\"]?") do
local str_end = string.sub(value, -1, -1)
if str_end == "'" or str_end == '"' then
value = string.sub(value, 1, -2)
end
env[name] = value
end
end
end
return env
end
M.run_all = function()
local neotest = require "neotest"
if lvim.builtin.task_runner == "overseer" then
neotest.run.run(vim.fn.expand "%")
else
for _, adapter_id in ipairs(neotest.run.adapters()) do
neotest.run.run { suite = true, adapter = adapter_id }
end
end
end
M.cancel = function()
require("neotest").run.stop { interactive = true }
end
M.run_file_sync = function()
require("neotest").run.run { vim.fn.expand "%", concurrent = false }
end
return M