refactor(tests): pr changes

This commit is contained in:
Jonas Holst Damtoft 2023-05-22 20:31:27 +02:00
parent 1e566b49b5
commit b5318d6635
2 changed files with 10 additions and 22 deletions

View file

@ -52,6 +52,7 @@ vim.api.nvim_create_autocmd("FileType", {
"startuptime",
"tsplayground",
"checkhealth",
"neotest-output",
},
callback = function(event)
vim.bo[event.buf].buflisted = false

View file

@ -1,39 +1,26 @@
return {
{
"nvim-neotest/neotest",
dependencies = {
-- which key integration
{
"folke/which-key.nvim",
opts = {
defaults = {
["<leader>t"] = { name = "+test" },
},
},
"folke/which-key.nvim",
optional = true,
opts = {
defaults = {
["<leader>t"] = { name = "+test" },
},
},
},
{
"nvim-neotest/neotest",
config = function(_, opts)
-- get neotest namespace (api call creates or returns namespace)
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)
local group = vim.api.nvim_create_augroup("lazyvim_neotest_close_with_q", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = group,
pattern = {
"neotest-output",
},
callback = function(event)
vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
end,
})
require("neotest").setup(opts)
end,