Skip to content

Commit

Permalink
Fix neotest rustaceanvim config
Browse files Browse the repository at this point in the history
  • Loading branch information
esensar committed Dec 3, 2024
1 parent adc0ca3 commit e30b23f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 54 deletions.
53 changes: 0 additions & 53 deletions symlinks/config/nvim/after/plugin/testing.lua

This file was deleted.

65 changes: 64 additions & 1 deletion symlinks/config/nvim/lua/esensar/init/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,70 @@ return require("lazy").setup({

-- Tools
"direnv/direnv.vim", -- Integration with Direnv
"nvim-neotest/neotest", -- Running tests from NeoVim
{
"nvim-neotest/neotest", -- Running tests from NeoVim
keys = {
{ "<Leader>tn", mode = "n" },
{ "<Leader>tdn", mode = "n" },
{ "<Leader>tf", mode = "n" },
{ "<Leader>tdf", mode = "n" },
{ "<Leader>tl", mode = "n" },
{ "<Leader>ts", mode = "n" },
{ "<Leader>tds", mode = "n" },
{ "<Leader>tp", mode = "n" },
},
config = function()
local neotest = require("neotest")
neotest.setup({
adapters = {
require("rustaceanvim.neotest")({
args = { "--no-capture" },
}),
require("neotest-plenary"),
require("neotest-vim-test")({
ignore_file_types = { "rust", "lua" },
}),
},
})

local last = nil

-- Map test running commands
local opts = { silent = true }
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)
else
neotest.run.run()
end
end, opts)
vim.keymap.set("n", "<Leader>tp", neotest.output_panel.open, opts)
end,
},
"nvim-neotest/nvim-nio",
"nvim-neotest/neotest-plenary",
"saecki/crates.nvim",
Expand Down

0 comments on commit e30b23f

Please sign in to comment.