feat(test): added easy way to configure adapters

This commit is contained in:
Folke Lemaitre 2023-05-22 21:31:07 +02:00
parent 78298cb134
commit 7443effe26
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -10,6 +10,12 @@ return {
},
{
"nvim-neotest/neotest",
opts = {
adapter_config = {
-- ["adapter_name"] = {} -- set adapter config here
},
adapters = {},
},
config = function(_, opts)
local neotest_ns = vim.api.nvim_create_namespace("neotest")
vim.diagnostic.config({
@ -22,6 +28,15 @@ return {
},
}, 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)
end,
-- stylua: ignore