✨ feat(nvim): new tests for neotest
This commit is contained in:
parent
e661dcc628
commit
774f2b01e8
1 changed files with 59 additions and 0 deletions
59
.config/nvim/lua/plugins/extras/test-extended.lua
Normal file
59
.config/nvim/lua/plugins/extras/test-extended.lua
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
dependencies = {
|
||||||
|
"haydenmeade/neotest-jest",
|
||||||
|
"marilari88/neotest-vitest",
|
||||||
|
"adrigzr/neotest-mocha",
|
||||||
|
"nvim-neotest/neotest-python",
|
||||||
|
"rouge8/neotest-rust",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>tl",
|
||||||
|
function()
|
||||||
|
require("neotest").run.run_last()
|
||||||
|
end,
|
||||||
|
desc = "Run Last Test",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tL",
|
||||||
|
function()
|
||||||
|
require("neotest").run.run_last({ strategy = "dap" })
|
||||||
|
end,
|
||||||
|
desc = "Debug Last Test",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tw",
|
||||||
|
"<cmd>lua require('neotest').run.run({ jestCommand = 'jest --watch ' })<cr>",
|
||||||
|
desc = "Run Watch",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(
|
||||||
|
opts.adapters,
|
||||||
|
require("neotest-jest")({
|
||||||
|
jestCommand = "npm test --",
|
||||||
|
jestConfigFile = "custom.jest.config.ts",
|
||||||
|
env = { CI = true },
|
||||||
|
cwd = function()
|
||||||
|
return vim.fn.getcwd()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
table.insert(opts.adapters, require("neotest-vitest"))
|
||||||
|
table.insert(opts.adapters, require("neotest-rust"))
|
||||||
|
table.insert(opts.adapters, require("neotest-python"))
|
||||||
|
table.insert(
|
||||||
|
opts.adapters,
|
||||||
|
require("neotest-mocha")({
|
||||||
|
command = "npm test --",
|
||||||
|
env = { CI = true },
|
||||||
|
cwd = function(path)
|
||||||
|
return vim.fn.getcwd()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue