diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-09-24 04:19:28 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-09-24 04:19:28 +0200 |
| commit | 7ed2303648bf83bb081d9bd863660ebf2344ce47 (patch) | |
| tree | 702f5f832796b572d0faee31c0eb15507e91f49a /lua/plugins/neotest.lua | |
| parent | 2a8020a2e9b7ef2ee77ddee14892127a4eb95187 (diff) | |
| download | dotfiles-7ed2303648bf83bb081d9bd863660ebf2344ce47.tar.gz dotfiles-7ed2303648bf83bb081d9bd863660ebf2344ce47.zip | |
Squashed 'common/config/nvim/' changes from 2a8020a..966d12a
966d12a Update/Overhaul
git-subtree-dir: common/config/nvim
git-subtree-split: 966d12ac730c83da90d60ab24eae539b2ea69441
Diffstat (limited to 'lua/plugins/neotest.lua')
| -rwxr-xr-x[-rw-r--r--] | lua/plugins/neotest.lua | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index aa73899..1034d33 100644..100755 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -1,11 +1,38 @@ -require("neotest").setup({ - adapters = { - require("neotest-python")({ +local M = {} + +function M.setup() + local ok, neotest = pcall(require, "neotest") + if not ok or not neotest then + return false + end + + -- Safely require adapters + local python_ok, python_adapter = pcall(require, "neotest-python") + local plenary_ok, plenary_adapter = pcall(require, "neotest-plenary") + local vim_test_ok, vim_test_adapter = pcall(require, "neotest-vim-test") + + local adapters = {} + if python_ok and python_adapter then + table.insert(adapters, python_adapter({ dap = { justMyCode = false }, - }), - require("neotest-plenary"), - require("neotest-vim-test")({ + })) + end + + if plenary_ok and plenary_adapter then + table.insert(adapters, plenary_adapter) + end + + if vim_test_ok and vim_test_adapter then + table.insert(adapters, vim_test_adapter({ ignore_file_types = { "python", "vim", "lua" }, - }), - }, -}) + })) + end + + neotest.setup({ + adapters = adapters, + }) + + return true +end + +return M |
