Skip to content

Commit

Permalink
chore: adding neotest to lazyvim
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-cpp committed Oct 31, 2024
1 parent 6c94f26 commit 4a045ee
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .config/nvim-lazy/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"neogen": { "branch": "main", "commit": "e932ba918b56723436b77aa3efb844a11b2851ab" },
"neogit": { "branch": "master", "commit": "001f43f50d9589d837cec59004fd92486ab06870" },
"neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" },
"neotest-elixir": { "branch": "master", "commit": "c5067bcc3ec6a0bba7b5694fa15aeb17f16aeb3c" },
"neotest-golang": { "branch": "main", "commit": "c3f8b231f49a5bdfa3d0725e1b1b45104b578a2c" },
"neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" },
"neovim-session-manager": { "branch": "master", "commit": "35c154a4b904cbe2aa7acce00a8c1c54a8831780" },
"noice.nvim": { "branch": "main", "commit": "df448c649ef6bc5a6a633a44f2ad0ed8d4442499" },
"nordic.nvim": { "branch": "main", "commit": "1ee4044077059b34eacd18d93613495a602c131f" },
Expand Down
2 changes: 2 additions & 0 deletions .config/nvim-lazy/lua/config/lazy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.lang.php" },

{ import = "lazyvim.plugins.extras.editor.fzf" },

{ import = "lazyvim.plugins.extras.test.core" },
-- import/override with your plugins
{ import = "plugins" },
{ import = "plugins.lsps" },
Expand Down
1 change: 1 addition & 0 deletions .config/nvim-lazy/lua/plugins/lsps/copilot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ return {
require("copilot").setup({
suggestion = {
auto_trigger = true,
keymap = { accept = "<C-l>" },
},
filetypes = {
yaml = true,
Expand Down
50 changes: 50 additions & 0 deletions .config/nvim-lazy/lua/plugins/tests.lua
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,
},
},
},
}
4 changes: 1 addition & 3 deletions .config/nvim/lua/plugins/copilot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ return {
require('copilot').setup({
suggestion = {
auto_trigger = true,
keymap = {
accept = '<C-l>',
},
keymap = { accept = '<C-l>' },
},
filetypes = {
yaml = true,
Expand Down

0 comments on commit 4a045ee

Please sign in to comment.