@@ -237,11 +237,9 @@ return {
237237 return vim .bo [buf ].buftype == " help"
238238 end ,
239239 },
240- { title = " Neotest Output" , ft = " neotest-output-panel" , size = { height = 15 } },
241240 },
242241 left = {},
243242 right = {
244- { title = " Neotest Summary" , ft = " neotest-summary" , size = { width = 0.25 } },
245243 -- { title = "Grug Far", ft = "grug-far", size = { width = 0.4 } },
246244 },
247245 keys = {
@@ -415,8 +413,6 @@ return {
415413 disabled_filetypes = {
416414 " gitsigns-blame" ,
417415 " neo-tree" ,
418- " neotest-output-panel" ,
419- " neotest-summary" ,
420416 },
421417 globalstatus = false ,
422418 icons_enabled = true ,
@@ -611,171 +607,6 @@ return {
611607 },
612608 },
613609
614- -- neotest (https://github.com/nvim-neotest/neotest)
615- {
616- " nvim-neotest/neotest" ,
617- dependencies = {
618- " nvim-neotest/nvim-nio" ,
619- -- adapters
620- " jfpedroza/neotest-elixir" ,
621- " marilari88/neotest-vitest" ,
622- },
623- -- stylua: ignore
624- keys = {
625- {" <leader>t" , " " , desc = " +test" },
626- { " <leader>tt" , function () require (" neotest" ).run .run (vim .fn .expand (" %" )) end , desc = " Run File" },
627- { " <leader>td" , function () require (" neotest" ).run .run ({ strategy = " dap" }) end , desc = " Debug Nearest" },
628- { " <leader>tT" , function () require (" neotest" ).run .run (vim .uv .cwd ()) end , desc = " Run All Test Files" },
629- { " <leader>tr" , function () require (" neotest" ).run .run () end , desc = " Run Nearest" },
630- { " <leader>tl" , function () require (" neotest" ).run .run_last () end , desc = " Run Last" },
631- { " <leader>ts" , function () require (" neotest" ).summary .toggle () end , desc = " Toggle Summary" },
632- { " <leader>to" , function () require (" neotest" ).output .open ({ enter = true , auto_close = true }) end , desc = " Show Output" },
633- { " <leader>tO" , function () require (" neotest" ).output_panel .toggle () end , desc = " Toggle Output Panel" },
634- { " <leader>tS" , function () require (" neotest" ).run .stop () end , desc = " Stop" },
635- { " <leader>tw" , function () require (" neotest" ).watch .toggle (vim .fn .expand (" %" )) end , desc = " Toggle Watch" },
636- },
637- opts = {
638- adapters = {
639- [" neotest-elixir" ] = {},
640- [" neotest-vitest" ] = {
641- vitestCommand = function (file )
642- local util = require (" neotest-vitest.util" )
643-
644- local function search_vitest_recursively (path )
645- if path == " /" then
646- return nil
647- end
648-
649- local rootPath = util .find_node_modules_ancestor (path )
650- local vitestBinary = util .path .join (rootPath , " node_modules" , " .bin" , " vitest" )
651- if util .path .exists (vitestBinary ) then
652- return vitestBinary
653- end
654-
655- return search_vitest_recursively (util .path .dirname (path ))
656- end
657-
658- return search_vitest_recursively (util .path .dirname (file ))
659- end ,
660- vitestConfigFile = function (file )
661- local util = require (" neotest-vitest.util" )
662- local filenamePattern = " {vite,vitest}.config.{js,ts}"
663- local rootPath = util .root_pattern (filenamePattern )(file )
664- or util .root_pattern (" test/" .. filenamePattern )(file )
665-
666- if not rootPath then
667- return nil
668- end
669-
670- -- Ordered by config precedence (https://vitest.dev/config/#configuration)
671- local possibleVitestConfigNames = {
672- " vitest.config.ts" ,
673- " vitest.config.js" ,
674- " vite.config.ts" ,
675- " vite.config.js" ,
676- }
677-
678- -- stylua: ignore
679- for _ , configName in ipairs (possibleVitestConfigNames ) do
680- local configPath = util .path .join (rootPath , configName )
681- if util .path .exists (configPath ) then return configPath end
682- configPath = util .path .join (rootPath , " test" , configName )
683- if util .path .exists (configPath ) then return configPath end
684- end
685-
686- return nil
687- end ,
688- },
689- },
690- output = { open_on_run = true },
691- quickfix = {
692- open = function ()
693- if require (" util.init" ).has (" trouble.nvim" ) then
694- require (" trouble" ).open ({ mode = " quickfix" , focus = false })
695- else
696- vim .cmd (" copen" )
697- end
698- end ,
699- },
700- status = {
701- signs = false ,
702- virtual_text = true ,
703- },
704- },
705- config = function (_ , opts )
706- local neotest_ns = vim .api .nvim_create_namespace (" neotest" )
707- vim .diagnostic .config ({
708- virtual_text = {
709- format = function (diagnostic )
710- -- Replace newline and tab characters with space for more compact diagnostics
711- local message = diagnostic .message :gsub (" \n " , " " ):gsub (" \t " , " " ):gsub (" %s+" , " " ):gsub (" ^%s+" , " " )
712- return message
713- end ,
714- },
715- }, neotest_ns )
716-
717- if require (" util.init" ).has (" trouble.nvim" ) then
718- opts .consumers = opts .consumers or {}
719- opts .consumers .trouble = function (client )
720- client .listeners .results = function (adapter_id , results , partial )
721- if partial then
722- return
723- end
724- local tree = assert (client :get_position (nil , { adapter = adapter_id }))
725-
726- local failed = 0
727- for pos_id , result in pairs (results ) do
728- if result .status == " failed" and tree :get_key (pos_id ) then
729- failed = failed + 1
730- end
731- end
732- vim .schedule (function ()
733- local trouble = require (" trouble" )
734- if trouble .is_open () then
735- trouble .refresh ()
736- if failed == 0 then
737- trouble .close ()
738- end
739- end
740- end )
741- return {}
742- end
743- end
744- end
745-
746- if opts .adapters then
747- local adapters = {}
748- for name , config in pairs (opts .adapters or {}) do
749- if type (name ) == " number" then
750- if type (config ) == " string" then
751- config = require (config )
752- end
753- adapters [# adapters + 1 ] = config
754- elseif config ~= false then
755- local adapter = require (name )
756- if type (config ) == " table" and not vim .tbl_isempty (config ) then
757- local meta = getmetatable (adapter )
758- if adapter .setup then
759- adapter .setup (config )
760- elseif adapter .adapter then
761- adapter .adapter (config )
762- adapter = adapter .adapter
763- elseif meta and meta .__call then
764- adapter (config )
765- else
766- error (" Adapter " .. name .. " does not support setup" )
767- end
768- end
769- adapters [# adapters + 1 ] = adapter
770- end
771- end
772- opts .adapters = adapters
773- end
774-
775- require (" neotest" ).setup (opts )
776- end ,
777- },
778-
779610 -- neo-tree.nvim (https://github.com/nvim-neo-tree/neo-tree.nvim)
780611 {
781612 " nvim-neo-tree/neo-tree.nvim" ,
0 commit comments