diff --git a/lua/lazyvim/config/autocmds.lua b/lua/lazyvim/config/autocmds.lua index 5b0b394d..9f67206d 100644 --- a/lua/lazyvim/config/autocmds.lua +++ b/lua/lazyvim/config/autocmds.lua @@ -52,6 +52,7 @@ vim.api.nvim_create_autocmd("FileType", { "startuptime", "tsplayground", "checkhealth", + "neotest-output", }, callback = function(event) vim.bo[event.buf].buflisted = false diff --git a/lua/lazyvim/plugins/extras/test/core.lua b/lua/lazyvim/plugins/extras/test/core.lua new file mode 100644 index 00000000..a3d7da6a --- /dev/null +++ b/lua/lazyvim/plugins/extras/test/core.lua @@ -0,0 +1,45 @@ +return { + { + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["t"] = { name = "+test" }, + }, + }, + }, + { + "nvim-neotest/neotest", + 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) + + 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" }, + }, + }, +}