mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-09 08:54:38 +02:00
feat(test): added easy way to configure adapters
This commit is contained in:
parent
78298cb134
commit
7443effe26
1 changed files with 15 additions and 0 deletions
|
@ -10,6 +10,12 @@ return {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-neotest/neotest",
|
"nvim-neotest/neotest",
|
||||||
|
opts = {
|
||||||
|
adapter_config = {
|
||||||
|
-- ["adapter_name"] = {} -- set adapter config here
|
||||||
|
},
|
||||||
|
adapters = {},
|
||||||
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
local neotest_ns = vim.api.nvim_create_namespace("neotest")
|
local neotest_ns = vim.api.nvim_create_namespace("neotest")
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
|
@ -22,6 +28,15 @@ return {
|
||||||
},
|
},
|
||||||
}, neotest_ns)
|
}, neotest_ns)
|
||||||
|
|
||||||
|
if opts.adapter_config then
|
||||||
|
for a, adapter in ipairs(opts.adapters or {}) do
|
||||||
|
local name = adapter.name
|
||||||
|
if opts.adapter_config[name] then
|
||||||
|
opts.adapters[a] = adapter(opts.adapter_config[name])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require("neotest").setup(opts)
|
require("neotest").setup(opts)
|
||||||
end,
|
end,
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue