Files
consultant-windows/AppData/Local/nvim/lua/plugins/neotest.lua
2025-12-05 09:54:42 +01:00

53 lines
1.4 KiB
Lua

return {
{
'nvim-neotest/neotest',
dependencies = {
'nvim-lua/plenary.nvim',
'antoinemadec/FixCursorHold.nvim',
'nvim-neotest/neotest-python',
},
config = function()
local neotest = require 'neotest'
neotest.setup {
adapters = {
require 'neotest-python' {
dap = { justMyCode = false },
args = { '--maxfail=1' },
runner = 'pytest',
},
},
}
-- Keymaps
vim.keymap.set('n', '<leader>tr', function()
neotest.run.run()
end, { desc = 'Run nearest test' })
vim.keymap.set('n', '<leader>tf', function()
neotest.run.run(vim.fn.expand '%')
end, { desc = 'Run tests in file' })
vim.keymap.set('n', '<leader>td', function()
neotest.run.run { strategy = 'dap' }
end, { desc = 'Debug nearest test' })
vim.keymap.set('n', '<leader>ts', function()
neotest.summary.toggle()
end, { desc = 'Toggle test summary' })
vim.keymap.set('n', '<leader>to', function()
neotest.output.open { enter = true }
end, { desc = 'Show test output' })
vim.keymap.set('n', '<leader>tO', function()
neotest.output_panel.toggle()
end, { desc = 'Toggle output panel' })
vim.keymap.set('n', '<leader>tw', function()
neotest.watch.toggle(vim.fn.expand '%')
end, { desc = 'Toggle watch for file' })
end,
},
}