return { { "folke/which-key.nvim", optional = true, opts = { defaults = { ["t"] = { name = "+test" }, }, }, }, { "nvim-neotest/neotest", opts = { -- Can be a list of adapters like what neotest expects, -- or a table of adapter names, mapped to adapter configs. -- The adapter will then be automatically loaded with the config. adapters = {}, -- Example for loading neotest-go with a custom config -- adapters = { -- ["neotest-go"] = { -- args = { "-tags=integration" }, -- }, -- }, quickfix = { open = function() if require("lazyvim.util").has("trouble.nvim") then vim.cmd("Trouble quickfix") else vim.cmd("copen") end end, }, }, config = function(_, opts) local neotest_ns = vim.api.nvim_create_namespace("neotest") vim.diagnostic.config({ virtual_text = { format = function(diagnostic) -- Replace newline and tab characters with space for more compact diagnostics local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "") return message end, }, }, neotest_ns) if opts.adapters then local adapters = {} for name, config in pairs(opts.adapters or {}) do if type(name) == "number" then adapters[#adapters + 1] = config elseif config ~= false then local adapter = require(name) if type(config) == "table" and not vim.tbl_isempty(config) then adapter = adapter(config) end adapters[#adapters + 1] = adapter end end opts.adapters = adapters end require("neotest").setup(opts) end, -- stylua: ignore keys = { { "tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, { "tR", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, { "tS", function() require("neotest").run.stop() end, desc = "Stop" }, }, }, { "mfussenegger/nvim-dap", optional = true, -- stylua: ignore keys = { { "td", function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" }, }, }, }