-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c94f26
commit 4a045ee
Showing
5 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
local group = vim.api.nvim_create_augroup("sp_tests", { clear = true }) | ||
|
||
vim.api.nvim_create_autocmd("BufReadPost", { | ||
pattern = { | ||
"*.test.js", | ||
"*.spec.js", | ||
"*.test.ts", | ||
"*.spec.ts", | ||
"*.test.jsx", | ||
"*.spec.jsx", | ||
"*.test.tsx", | ||
"*.spec.tsx", | ||
}, | ||
description = "Neotest binds", | ||
callback = function(args) | ||
local bufnr = args.buf | ||
vim.keymap.set("n", "<leader>tw", function() | ||
require("neotest").run.run({ vim.fn.expand("%"), jestCommand = "jest --watch " }) | ||
end, { | ||
buffer = bufnr, | ||
description = "Run test in watch mode(current file)", | ||
}) | ||
vim.keymap.set("n", "<leader>tW", function() | ||
require("neotest").run.run({ jestCommand = "jest --watch " }) | ||
end, { | ||
buffer = bufnr, | ||
description = "Run test in watch mode(project)", | ||
}) | ||
end, | ||
}) | ||
|
||
---@type LazySpec | ||
return { | ||
"nvim-neotest/neotest", | ||
dependencies = { | ||
"marilari88/neotest-vitest", | ||
"nvim-neotest/neotest-jest", | ||
}, | ||
opts = { | ||
adapters = { | ||
["neotest-jest"] = {}, | ||
["neotest-vitest"] = { | ||
-- Filter directories when searching for test files. Useful in large projects (see Filter directories notes). | ||
filter_dir = function(name, rel_path, root) | ||
return name ~= "node_modules" | ||
end, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters