mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-25 02:08:48 +02:00
Updated 7. Example Custom Plugins (markdown)
parent
6f718e517c
commit
9bbe8a6e5d
1 changed files with 94 additions and 0 deletions
|
@ -2875,4 +2875,98 @@ return {
|
|||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
# Neotest-Jest
|
||||
```lua
|
||||
return {
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = {
|
||||
"nvim-neotest/neotest-jest",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
config = function()
|
||||
require("neotest").setup {
|
||||
adapters = {
|
||||
require "neotest-jest" {
|
||||
jestCommand = "npm test -- ",
|
||||
jestConfigFile = function()
|
||||
local file = vim.fn.expand "%:p"
|
||||
if string.find(file, "/packages/") then
|
||||
return string.match(file, "(.-/[^/]+/)src") .. "jest.config.mjs"
|
||||
end
|
||||
return vim.fn.getcwd() .. "/jest.config.mjs"
|
||||
end,
|
||||
env = { CI = true },
|
||||
cwd = function()
|
||||
local file = vim.fn.expand "%:p"
|
||||
if string.find(file, "/packages/") then
|
||||
return string.match(file, "(.-/[^/]+/)src")
|
||||
end
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
status = { virtual_text = true },
|
||||
output = { open_on_run = true },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>Tt",
|
||||
function()
|
||||
require("neotest").run.run(vim.fn.expand "%")
|
||||
end,
|
||||
desc = "Run File",
|
||||
},
|
||||
{
|
||||
"<leader>Tr",
|
||||
function()
|
||||
require("neotest").run.run()
|
||||
end,
|
||||
desc = "Run Nearest",
|
||||
},
|
||||
{
|
||||
"<leader>TT",
|
||||
function()
|
||||
require("neotest").run.run(vim.loop.cwd())
|
||||
end,
|
||||
desc = "Run All Test Files",
|
||||
},
|
||||
{
|
||||
"<leader>Tl",
|
||||
function()
|
||||
require("neotest").run.run_last()
|
||||
end,
|
||||
desc = "Run Last",
|
||||
},
|
||||
{
|
||||
"<leader>Ts",
|
||||
function()
|
||||
require("neotest").summary.toggle()
|
||||
end,
|
||||
desc = "Toggle Summary",
|
||||
},
|
||||
{
|
||||
"<leader>To",
|
||||
function()
|
||||
require("neotest").output.open { enter = true, auto_close = true }
|
||||
end,
|
||||
desc = "Show Output",
|
||||
},
|
||||
{
|
||||
"<leader>TO",
|
||||
function()
|
||||
require("neotest").output_panel.toggle()
|
||||
end,
|
||||
desc = "Toggle Output Panel",
|
||||
},
|
||||
{
|
||||
"<leader>TS",
|
||||
function()
|
||||
require("neotest").run.stop()
|
||||
end,
|
||||
desc = "Stop",
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue