adrigzr / neotest-mocha

Neotest runner for Mocha test framework
9 stars 9 forks source link

lazy.nvim Failed to run `config` for neotest #11

Closed mikaoelitiana closed 8 months ago

mikaoelitiana commented 10 months ago

I have the following error when using neotest-mocha with LazyVim:

   Error  17:43:42 notify.error lazy.nvim Failed to run `config` for neotest

...share/nvim/lazy/neotest-mocha/lua/neotest-mocha/init.lua:4: loop or previous error loading module 'neotest-mocha.util'

# stacktrace:
  - /neotest-mocha/lua/neotest-mocha/init.lua:4
  - /LazyVim/lua/lazyvim/plugins/extras/test/core.lua:89 _in_ **config**
  - /neotest-mocha/lua/neotest-mocha/util.lua:4
  - lua:1

Here is my configuration :

{
    "nvim-neotest/neotest",
    dependencies = { "adrigzr/neotest-mocha", "nvim-neotest/neotest-jest", "marilari88/neotest-vitest" },
    opts = function(_, opts)
      local mocha_util = require("neotest-mocha.util")
      local is_mocha_test_file = mocha_util.create_test_file_extensions_matcher(
        { "-test" },
        { "js", "mjs", "cjs", "jsx", "coffee", "ts", "tsx" }
      )

      opts.adapters = {
        ["neotest-jest"] = {
          jestCommand = Neotest_jest_command ~= nil and Neotest_jest_command or "npm test --",
          env = Neotest_jest_env ~= nil and Neotest_jest_env or { CI = true },
        },
        ["neotest-mocha"] = {
          command = get_var("neotest_mocha_command", "npm test --"),
          env = neotest_mocha_env ~= nil and neotest_mocha_env or { CI = true },
          cwd = function(path)
            return vim.fn.getcwd()
          end,
          is_test_file = neotest_mocha_is_test_file ~= nil and neotest_mocha_is_test_file or is_mocha_test_file,
        },
        ['neotest-vitest'] = {}
      }

      opts.status = {
        enabled = true,
        signs = true,
        virtual_text = false,
      }

      opts.consumers = {
        overseer = require("neotest.consumers.overseer"),
      }
    end,
    keys = {
      --   {
      --     "<leader>tf",
      --     function()
      --       require("neotest").run.run(vim.fn.expand("%"))
      --     end,
      --     desc = "Run current test file",
      --   },
      --   {
      --     "<leader>tn",
      --     function()
      --       require("neotest").run.run()
      --     end,
      --     desc = "Run nearest test",
      --   },
      {
        "<leader>tl",
        function()
          require("neotest").run.run_last()
        end,
        desc = "Run last test",
      },
      --   {
      --     "<leader>td",
      --     function()
      --       require("neotest").run.run({ strategy = "dap" })
      --     end,
      --     desc = "Debug nearest test",
      --   },
      --   {
      --     "<leader>ts",
      --     function()
      --       require("neotest").summary.toggle()
      --     end,
      --     desc = "Toggle summary view",
      --   },
      --   {
      --     "<leader>to",
      --     function()
      --       require("neotest").output.open({ enter = true })
      --     end,
      --     desc = "View output",
      --   },
    },
  }
mikaoelitiana commented 10 months ago

Downgrading to commit https://github.com/adrigzr/neotest-mocha/commit/765a4e976927174518bfe311a169780e4d3bf234 fixed the issue for me