2022-05-03 16:56:58 +00:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
-- - Vim-test and general testing config -
|
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2023-08-02 17:04:01 +00:00
|
|
|
local neotest = require("neotest")
|
|
|
|
neotest.setup({
|
|
|
|
adapters = {
|
|
|
|
require("neotest-rust"),
|
|
|
|
require("neotest-plenary"),
|
|
|
|
require("neotest-vim-test")({
|
|
|
|
ignore_file_types = { "rust", "lua" },
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
local last = nil
|
2022-05-03 16:56:58 +00:00
|
|
|
|
|
|
|
-- Map test running commands
|
|
|
|
local opts = { silent = true }
|
2023-08-02 17:04:01 +00:00
|
|
|
vim.keymap.set("n", "<Leader>tn", function()
|
|
|
|
last = nil
|
|
|
|
neotest.run.run()
|
|
|
|
end, opts)
|
|
|
|
vim.keymap.set("n", "<Leader>tdn", function()
|
|
|
|
last = { strategy = "dap", suite = false }
|
|
|
|
neotest.run.run(last)
|
|
|
|
end, opts)
|
|
|
|
vim.keymap.set("n", "<Leader>tf", function()
|
|
|
|
last = vim.fn.expand("%")
|
|
|
|
neotest.run.run(last)
|
|
|
|
end, opts)
|
|
|
|
vim.keymap.set("n", "<Leader>tdf", function()
|
|
|
|
last = { vim.fn.expand("%"), strategy = "dap", suite = false }
|
|
|
|
neotest.run.run(last)
|
|
|
|
end, opts)
|
|
|
|
vim.keymap.set("n", "<Leader>ts", function()
|
|
|
|
last = { suite = true }
|
|
|
|
neotest.run.run(last)
|
|
|
|
end, opts)
|
|
|
|
vim.keymap.set("n", "<Leader>tds", function()
|
|
|
|
last = { strategy = "dap", suite = true }
|
|
|
|
neotest.run.run(last)
|
|
|
|
end, opts)
|
|
|
|
vim.keymap.set("n", "<Leader>tl", function()
|
|
|
|
if last then
|
|
|
|
neotest.run.run(last)
|
2022-05-10 08:54:26 +00:00
|
|
|
else
|
2023-08-02 17:04:01 +00:00
|
|
|
neotest.run.run()
|
2022-05-07 18:56:11 +00:00
|
|
|
end
|
2023-08-02 17:04:01 +00:00
|
|
|
end, opts)
|
2023-08-03 10:02:52 +00:00
|
|
|
vim.keymap.set("n", "<Leader>tp", neotest.output_panel.open, opts)
|