Skip to main content

Neotest

Please make sure to read the neotest docs on how to add test adapters.

Example on adding the plenary test adapter:

~/.config/nvim/lua/plugins/test.lua
return {
{ "nvim-neotest/neotest-plenary" },
{
"nvim-neotest/neotest",
opts = { adapters = { "neotest-plenary" } },
},
}
info

You can enable the extra with the :LazyExtras command. Plugins marked as optional will only be configured if they are installed.

Alternatively, you can add it to your lazy.nvim imports
lua/config/lazy.lua
require("lazy").setup({
spec = {
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.test.core" },
{ import = "plugins" },
},
})

Below you can find a list of included plugins and their default settings.

caution

You don't need to copy the default settings to your config. They are only shown here for reference.

neotest

opts = {
-- Can be a list of adapters like what neotest expects,
-- or a list of adapter names,
-- 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" },
-- },
-- },
status = { virtual_text = true },
output = { open_on_run = true },
quickfix = {
open = function()
if LazyVim.has("trouble.nvim") then
require("trouble").open({ mode = "quickfix", focus = false })
else
vim.cmd("copen")
end
end,
},
}

nvim-nio

opts = nil

which-key.nvim (optional)

opts = {
defaults = {
["<leader>t"] = { name = "+test" },
},
}

nvim-dap (optional)

opts = nil