-
Notifications
You must be signed in to change notification settings - Fork 2
/
neotest.lua
85 lines (80 loc) · 2.7 KB
/
neotest.lua
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
return {
{
"nvim-neotest/neotest",
event = "VeryLazy",
dependencies = {
"nvim-neotest/nvim-nio",
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"nvim-neotest/neotest-plenary",
"nvim-neotest/neotest-vim-test",
{
"echasnovski/mini.indentscope",
opts = function()
-- disable indentation scope for the neotest-summary buffer
vim.cmd([[
autocmd Filetype neotest-summary lua vim.b.miniindentscope_disable = true
]])
end,
},
},
opts = {
-- See all config options with :h neotest.Config
discovery = {
-- Drastically improve performance in ginormous projects by
-- only AST-parsing the currently opened buffer.
enabled = true,
-- Number of workers to parse files concurrently.
-- A value of 0 automatically assigns number based on CPU.
-- Set to 1 if experiencing lag.
concurrent = 0,
},
running = {
-- Run tests concurrently when an adapter provides multiple commands to run.
concurrent = true,
},
summary = {
-- Enable/disable animation of icons.
animated = true,
},
},
config = function(_, opts)
if opts.adapters then
local adapters = {}
for name, config in pairs(opts.adapters or {}) do
if type(name) == "number" then
if type(config) == "string" then
config = require(config)
end
adapters[#adapters + 1] = config
elseif config ~= false then
local adapter = require(name)
if type(config) == "table" and not vim.tbl_isempty(config) then
local meta = getmetatable(adapter)
if adapter.setup then
adapter.setup(config)
elseif meta and meta.__call then
adapter(config)
else
error("Adapter " .. name .. " does not support setup")
end
end
adapters[#adapters + 1] = adapter
end
end
opts.adapters = adapters
end
-- Erase log file.
-- local filepath = require("neotest.logging"):get_filename()
-- vim.notify("Erasing Neotest log file: " .. filepath, vim.log.levels.WARN)
-- vim.fn.writefile({ "" }, filepath)
-- Set up Neotest.
require("neotest").setup(opts)
-- Enable during Neotest adapter development only.
-- vim.notify("Logging for Neotest enabled", vim.log.levels.TRACE)
-- require("neotest.logging"):set_level(vim.log.levels.INFO)
end,
keys = require("config.keymaps").setup_neotest_keymaps(),
},
}