From 774f2b01e815de1b64cbebf72d473d791a0f5fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Thu, 19 Oct 2023 20:22:55 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(nvim):=20new=20tests=20for=20n?= =?UTF-8?q?eotest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nvim/lua/plugins/extras/test-extended.lua | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .config/nvim/lua/plugins/extras/test-extended.lua diff --git a/.config/nvim/lua/plugins/extras/test-extended.lua b/.config/nvim/lua/plugins/extras/test-extended.lua new file mode 100644 index 00000000..4a39d9fa --- /dev/null +++ b/.config/nvim/lua/plugins/extras/test-extended.lua @@ -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 = { + { + "tl", + function() + require("neotest").run.run_last() + end, + desc = "Run Last Test", + }, + { + "tL", + function() + require("neotest").run.run_last({ strategy = "dap" }) + end, + desc = "Debug Last Test", + }, + { + "tw", + "lua require('neotest').run.run({ jestCommand = 'jest --watch ' })", + 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, + }, +}