nvim-neotest / neotest

An extensible framework for interacting with tests within NeoVim.
MIT License
2.12k stars 105 forks source link

feat(config): setup adapters with function #390

Closed olexsmir closed 2 months ago

olexsmir commented 2 months ago

Hey :wave:

I have a problem with setting up the plugin with lazy.nvim's opts because it would load adapters at the same time they weren't loaded, and because of that, I would fail. It might be prevented by wrapping adapters setup in function, so I made it.

The solution looks like this:

{
  "nvim-neotest/neotest",
  opts = {
    -- now `adapters` can be set up to {} as previously or to a function that will return {} of adapters
    adapters = function()
      return {
        require "neotest-plenary",
        require "neotest-go",
      }
    end,
  }
}

Also I believe it might help set up adapters on different conditions

rcarriga commented 2 months ago

Thanks for the PR, but this seems like more of an issue with your local setup and dependency resolution, I don't want to have this plugin adapt to the quirks of package managers unless there's a very good reason