stevearc / overseer.nvim

A task runner and job management plugin for Neovim
MIT License
1.26k stars 58 forks source link

bug: neotest consumer throws nil value error #352

Closed petobens closed 2 months ago

petobens commented 2 months ago

Neovim version (nvim -v)

NVIM v0.11.0-dev-774+g3b54adc6c6

Operating system/version

Arch Linux

Describe the bug

When I open nvim with the minimal lua file I get:

Failed to run `config` for neotest

...plugins/overseer.nvim/lua/neotest/consumers/overseer.lua:81: attempt to index field 'run' (a nil value)

# stacktrace:
  - /overseer.nvim/lua/neotest/consumers/overseer.lua:81 _in_ **__index**
  - vim/shared.lua:0 _in_ **islist**
  - vim/shared.lua:0 _in_ ****
  - vim/shared.lua:0 _in_ ****
  - vim/shared.lua:0 _in_ **tbl_deep_extend**
  - /neotest/lua/neotest/config/init.lua:444 _in_ **setup**
  - /neotest/lua/neotest/init.lua:97 _in_ **setup**
  - ~/git-repos/private/dotfiles/nvim/minimal.lua:31 _in_ **config**
  - ~/git-repos/private/dotfiles/nvim/minimal.lua:46

If i remove or comment the lines:

  __index = function(_, key)
    return neotest.run[key]
  end,

from consumers/overseer.lua (line 81) the error goes aways and everthing seems to work normally.

If I write the neotest consumer setup as

 consumers = {
      overseer = function() return require("neotest.consumers.overseer") end,
    },

then the error also goes aways but overseer is not used by neotest.

What is the severity of this bug?

blocking (cannot use plugin)

Steps To Reproduce

  1. Open nvim with the minimal init file provided
  2. You'll get the mentioned error

Expected Behavior

No error is shown and overseer/neotest play along together.

Minimal example file

No response

Minimal init.lua

local root = '/tmp/nvim-minimal'

-- Set stdpaths to use root dir
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
    vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- Bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        'git',
        'clone',
        '--filter=blob:none',
        '--single-branch',
        'https://github.com/folke/lazy.nvim.git',
        lazypath,
    })
end
vim.opt.runtimepath:prepend(lazypath)

-- Install plugins
local plugins = {
    {
        'nvim-neotest/neotest',
        dependencies = {
            'nvim-lua/plenary.nvim',
            'nvim-neotest/nvim-nio',
        },
        config = function()
            require('neotest').setup({
                consumers = {
                    overseer = require('neotest.consumers.overseer'),
                },
            })
        end,
    },
    {
        'stevearc/overseer.nvim',
        config = function()
            require('overseer').setup({})
        end,
    },
}

require('lazy').setup(plugins, {
    root = root .. '/plugins',
})

Additional context

No response

WayenVan commented 2 months ago

same here

stevearc commented 2 months ago

This was a bug specifically in neovim nightly. Looks like it was caused by some of the changes to tbl_deep_extend. I put in a guard to work around it.

petobens commented 2 months ago

Thank you!