jfpedroza / neotest-elixir

Neotest adapter for Elixir
MIT License
38 stars 10 forks source link

Nothing happens when running tests #25

Open natewallis opened 1 year ago

natewallis commented 1 year ago

Hi,

I am using Lazy to load plugins into NVIM and I am getting no feedback when running

lua require("neotest").run.run()

Here is my NVIM config for testing. I had previously installed vim-test, but then saw the developer was moving to a new project, so I installed that instead.

return {
  {
    -- wrapper for running tests of different granularities   You • Mon 22 May 09:55:56 2023 • comments and removes modules
    -- 'vim-test/vim-test',
    {
      'nvim-neotest/neotest',
      dependencies = {
        'nvim-lua/plenary.nvim',
        'nvim-treesitter/nvim-treesitter',
        'antoinemadec/FixCursorHold.nvim',
        'jfpedroza/neotest-elixir'
      },
      config = function()
        require('neotest').setup({
          adapters = {
            require('neotest-elixir')
          }
        })
      end
    },
    'jfpedroza/neotest-elixir',
  }
}

When I attempt to run the tests, it does nothing and I see no running tests. I am running the tests inside a vanilla scaffolded phoenix project.

Should I see a popup on the screen with test results?

jfpedroza commented 11 months ago

Hey, sorry. Were you able to solve it?

garaujodev commented 9 months ago

Hello @jfpedroza

I'm getting related behavior. I'm using Lazyvim too. When I run neotest I got No test found message.

Any suggestions?

jfpedroza commented 9 months ago

Does it happen only with Elixir? Have you tried another adapter?

em-jones commented 7 months ago

@garaujodev the only solution I've been able to come up with is to set the lazy setting to false :/

em-jones commented 7 months ago

another solution i just found involves setting the typical config setup step to the init function.

This is less-than ideal as it's going to mean initializing a neotest adapter I might not ever use. But, at least it doesn't load the entire plugin :shrug:

@jfpedroza I can confirm that using ft-based lazy-loading for python's neotest-python adapter works just fine.

jfpedroza commented 7 months ago

I recently migrated from packer to lazy and haven't really tried lazy loading. I have my config in after/plugin/neotest.lua.

As I understand it, if you specify all the adapters in neotest.setup(), they will all be loaded together. If you want to load the adapter only if you need it, you should use neotest.setup_project() to set up the adapters for a specific project.

For example, I have in my .nvim.lua in my Elixir project:

vim.schedule(function()
  require("neotest").setup_project(vim.loop.cwd(), {
    adapters = {
      require("neotest-elixir")({
        mix_task = "test.interactive",
        extra_formatters = { "ExUnit.CLIFormatter", "ExUnitNotifier" },
      }),
    },
  })
end)

Adapters are not standalone neovim plugins. They are always loaded by a call when you are setting up neotest.