From ad58a317b4a01e045e1c66b1f6466ac57162b023 Mon Sep 17 00:00:00 2001 From: Fey Naomi Schrewe Date: Sun, 8 Sep 2024 21:44:55 +0200 Subject: [PATCH] feat: add testing and debugging --- lazy-lock.json | 5 +++++ lua/lsp-setup.lua | 1 + lua/plugins/debug.lua | 21 +++++++++++++++++++++ lua/plugins/test.lua | 29 +++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 lua/plugins/debug.lua create mode 100644 lua/plugins/test.lua diff --git a/lazy-lock.json b/lazy-lock.json index 91183cd..48d951b 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,6 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "barbar.nvim": { "branch": "master", "commit": "31b6951c53a59bccfa91bf3984ed1510a940c836" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -20,9 +21,13 @@ "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, "neogit": { "branch": "master", "commit": "bc0c609e3568a171e0549b449aa1b2b4b5b20e8c" }, + "neotest": { "branch": "master", "commit": "6d6ad113f56edc7c3f2a77a0836ea8c1b955ebea" }, + "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" }, "nvim-dap": { "branch": "master", "commit": "20a4859ebde1c9bc8e96f8cc11a20667e7fdd516" }, "nvim-lspconfig": { "branch": "master", "commit": "bdbc65aadc708ce528efb22bca5f82a7cca6b54d" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, "nvim-test": { "branch": "main", "commit": "e06f3d029ee161f3ead6193cf27354d1eb8723c3" }, "nvim-treesitter": { "branch": "master", "commit": "00f128dd73086aa578dc3d9142de06c633b7c685" }, diff --git a/lua/lsp-setup.lua b/lua/lsp-setup.lua index b9a9e1a..a6f07a1 100644 --- a/lua/lsp-setup.lua +++ b/lua/lsp-setup.lua @@ -5,6 +5,7 @@ lspconfig.ts_ls.setup {} lspconfig.eslint.setup {} lspconfig.angularls.setup {} lspconfig.ccls.setup {} +lspconfig.nixd.setup{} -- Global mappings. -- See `:help vim.diagnostic.*` for documentation on any of the below functions diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua new file mode 100644 index 0000000..565a276 --- /dev/null +++ b/lua/plugins/debug.lua @@ -0,0 +1,21 @@ +return { + { + 'mfussenegger/nvim-dap', + keys = { + { '', require 'dap'.continue, desc = 'Continue debugging' }, + { '', require 'dap'.step_over, desc = 'Step over statement' }, + { '', require 'dap'.step_into, desc = 'Step into statement' }, + { '', require 'dap'.step_out, desc = 'Step out' }, + { 'b', require 'dap'.toggle_breakpoint, desc = 'Toggle breakpoint' }, + { + 'B', + function() + vim.ui.input({ prompt = 'Breakpoint condition: ' }, function(input) + require 'dap'.set_breakpoint(input) + end) + end + } + }, + lazy = true + } +} diff --git a/lua/plugins/test.lua b/lua/plugins/test.lua new file mode 100644 index 0000000..c138ba5 --- /dev/null +++ b/lua/plugins/test.lua @@ -0,0 +1,29 @@ +return { + { + 'nvim-neotest/neotest', + config = function () + require('neotest').setup({ + adapters = { + require('neotest-jest')({ + jestCommand = "npm test --", + jestConfigFile = "custom.jest.config.ts", + cwd = function(path) + return vim.fn.getcwd() + end, + }), + } + }) + end, + dependencies = { + 'nvim-neotest/nvim-nio', + 'nvim-lua/plenary.nvim', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-treesitter/nvim-treesitter', + 'nvim-neotest/neotest-jest' + } + }, + { + 'andythigpen/nvim-coverage', + dependencies = { 'nvim-lua/plenary.nvim' } + } +}