45 lines
1.6 KiB
Lua
45 lines
1.6 KiB
Lua
if vim.g.loaded_test_samurai_plugin == 1 then
|
|
return
|
|
end
|
|
vim.g.loaded_test_samurai_plugin = 1
|
|
|
|
vim.api.nvim_create_user_command("TSamNearest", function()
|
|
require("test-samurai").test_nearest()
|
|
end, { desc = "test-samurai: run nearest test" })
|
|
|
|
vim.api.nvim_create_user_command("TSamShowOutput", function()
|
|
require("test-samurai").show_output()
|
|
end, { desc = "test-samurai: show last test output" })
|
|
|
|
vim.api.nvim_create_user_command("TSamFile", function()
|
|
require("test-samurai").test_file()
|
|
end, { desc = "test-samurai: run all tests in current file" })
|
|
|
|
vim.api.nvim_create_user_command("TSamAll", function()
|
|
require("test-samurai").test_all()
|
|
end, { desc = "test-samurai: run all tests in project (per runner)" })
|
|
|
|
vim.api.nvim_create_user_command("TSamLast", function()
|
|
require("test-samurai").test_last()
|
|
end, { desc = "test-samurai: rerun last test command" })
|
|
|
|
vim.keymap.set("n", "<leader>tn", function()
|
|
require("test-samurai").test_nearest()
|
|
end, { desc = "test-samurai: run nearest test" })
|
|
|
|
vim.keymap.set("n", "<leader>to", function()
|
|
require("test-samurai").show_output()
|
|
end, { desc = "test-samurai: show last test output" })
|
|
|
|
vim.keymap.set("n", "<leader>tf", function()
|
|
require("test-samurai").test_file()
|
|
end, { desc = "test-samurai: run all tests in current file" })
|
|
|
|
vim.keymap.set("n", "<leader>ta", function()
|
|
require("test-samurai").test_all()
|
|
end, { desc = "test-samurai: run all tests in project (per runner)" })
|
|
|
|
vim.keymap.set("n", "<leader>tl", function()
|
|
require("test-samurai").test_last()
|
|
end, { desc = "test-samurai: rerun last test command" })
|