]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/test.lua
lazyvim: remove calls to lazyvim.util.has
[dotfiles.git] / nvim / lua / plugins / test.lua
index e4bc07c0f9d2bd6af57647bee3d48342a248806e..9e425c653dff133e48838a84ffc9fd30613c7799 100644 (file)
@@ -1,10 +1,4 @@
 return {
-  {
-    "folke/which-key.nvim",
-    opts = {
-      defaults = { ["<leader>t"] = { name = "+test" }, },
-    },
-  },
   {
     "nvim-neotest/neotest",
     opts = {
@@ -12,11 +6,7 @@ return {
       output = { open_on_run = true },
       quickfix = {
         open = function()
-          if require("lazyvim.util").has("trouble.nvim") then
-            require("trouble").open({ mode = "quickfix", focus = false })
-          else
-            vim.cmd("copen")
-          end
+          require("trouble").open({ mode = "quickfix", focus = false })
         end,
       },
     },
@@ -32,35 +22,33 @@ return {
         },
       }, neotest_ns)
 
-      if require("lazyvim.util").has("trouble.nvim") then
-        opts.consumers = opts.consumers or {}
-        -- Refresh and auto close trouble after running tests
-        ---@type neotest.Consumer
-        opts.consumers.trouble = function(client)
-          client.listeners.results = function(adapter_id, results, partial)
-            if partial then
-              return
-            end
-            local tree = assert(client:get_position(nil, { adapter = adapter_id }))
+      opts.consumers = opts.consumers or {}
+      -- Refresh and auto close trouble after running tests
+      ---@type neotest.Consumer
+      opts.consumers.trouble = function(client)
+        client.listeners.results = function(adapter_id, results, partial)
+          if partial then
+            return
+          end
+          local tree = assert(client:get_position(nil, { adapter = adapter_id }))
 
-            local failed = 0
-            for pos_id, result in pairs(results) do
-              if result.status == "failed" and tree:get_key(pos_id) then
-                failed = failed + 1
-              end
+          local failed = 0
+          for pos_id, result in pairs(results) do
+            if result.status == "failed" and tree:get_key(pos_id) then
+              failed = failed + 1
             end
-            vim.schedule(function()
-              local trouble = require("trouble")
-              if trouble.is_open() then
-                trouble.refresh()
-                if failed == 0 then
-                  trouble.close()
-                end
-              end
-            end)
           end
-          return {}
+          vim.schedule(function()
+            local trouble = require("trouble")
+            if trouble.is_open() then
+              trouble.refresh()
+              if failed == 0 then
+                trouble.close()
+              end
+            end
+          end)
         end
+        return {}
       end
 
       if opts.adapters then