From 7443effe269ad3b2d491f43439b48f1d072c9210 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Mon, 22 May 2023 21:31:07 +0200 Subject: [PATCH] feat(test): added easy way to configure adapters --- lua/lazyvim/plugins/extras/test/core.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua index a3d7da6a..2142dd80 100644 --- a/lua/lazyvim/plugins/extras/test/core.lua +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -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