fredrikaverpil / neotest-golang

Reliable Neotest adapter for running Go tests in Neovim.
MIT License
57 stars 5 forks source link

bug: tests don't start, crash from nio #61

Closed asfaltboy closed 6 days ago

asfaltboy commented 1 week ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.0

Operating system/version

MacOS 14.5

Describe the bug

Whenever I try to run tests with latest version of nio, neotest, and neotest-golang, I see this error:

neotest-golang: ...vchenko/.local/share/nvim/lazy/nvim-nio/lua/nio/init.lua:119: The coroutine failed with this message: 
vim/shared.lua:0: dst: expected table, got nil
stack traceback:
    [C]: in function 'error'
    vim/shared.lua: in function 'validate'
    vim/shared.lua: in function 'list_extend'
    .../lazy/neotest-golang/lua/neotest-golang/runspec_test.lua:27: in function 'build_spec'
    ...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:76: in function '_run_tree'
    ...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:144: in function <...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:143>
stack traceback:
    ...ocal/share/nvim/lazy/neotest/lua/neotest/client/init.lua:89: in function <...ocal/share/nvim/lazy/neotest/lua/neotest/client/init.lua:88>
    [C]: in function 'error'
    ...vchenko/.local/share/nvim/lazy/nvim-nio/lua/nio/init.lua:119: in function 'gather'
    ...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:153: in function '_run_broken_down_tree'
    ...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:79: in function '_run_tree'
    ...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:65: in function <...al/share/nvim/lazy/neotest/lua/neotest/client/runner.lua:22>
    [C]: in function 'xpcall'
    ...ocal/share/nvim/lazy/neotest/lua/neotest/client/init.lua:84: in function 'run_tree'
    ...al/share/nvim/lazy/neotest/lua/neotest/consumers/run.lua:73: in function 'func'
    ...chenko/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:173: in function <...chenko/.local/share/nvim/lazy/nvim-nio/lua/nio/tasks.lua:172>

Whether I select a specific test, or all tests in a file. Same tests run ok when using neotest-go instead

Steps To Reproduce

  1. run neotest on a go file

Expected Behavior

Should run tests

fredrikaverpil commented 6 days ago

Hi @asfaltboy and thanks for the report. I can't reproduce this on my end. What does your neotest config look like, and how do you register the load neotest-golang along with any options?

It looks like the go_test_args option (here) is somehow set to nil on your end, which is not a valid value.

uroborosq commented 6 days ago

Having the same issue with default config:

return {
    {
        "nvim-neotest/neotest",
        dependencies = {
            "nvim-neotest/nvim-nio",
            "nvim-lua/plenary.nvim",
            "antoinemadec/FixCursorHold.nvim",
            "nvim-treesitter/nvim-treesitter",
            "fredrikaverpil/neotest-golang",
        },
        config = function()
            require("neotest").setup {
                adapters = {
                    require "neotest-golang", 
                },
            }
        end,
    },
}

Issue doesn't reproduce with 'extra everything' config from README

fredrikaverpil commented 6 days ago

Thanks for the details. I believe I might have found the issue and I've pushed a PR.

Could you please help me out and see if this fixes this issue on your end? You can temporarily set the branch used in #63.

{
  "fredrikaverpil/neotest-golang",
  branch = "fix/options",
},
uroborosq commented 6 days ago

@fredrikaverpil yes, now it's fine. Thanks)

fredrikaverpil commented 6 days ago

Many thanks for the confirmation @uroborosq, I'm glad to hear this got fixed on your end as well šŸ„³

@asfaltboy I'm going to merge this fix in straight away as this was a significant mistake on my end. Please re-open this issue if it did not fix the problem on your end.