nvim-neotest / neotest-go

MIT License
124 stars 43 forks source link

nil error on test single function #47

Closed zankich closed 1 year ago

zankich commented 1 year ago

Hi!

When I run require('neotest').run.run() on a single function with a failing test I get the following stacktrace:

2023-05-08T14:38:41 Neotest ﭧ WARN neotest-go: ...nkich/.local/share/nvim/plugged/neotest/lua/nio/init.lua:105: The coroutine failed with this message:
...al/share/nvim/plugged/neotest-go/lua/neotest-go/init.lua:223: attempt to index a nil value
stack traceback:
        ...al/share/nvim/plugged/neotest-go/lua/neotest-go/init.lua: in function 'results'
        ...share/nvim/plugged/neotest/lua/neotest/client/runner.lua:131: in function '_run_spec'
        ...share/nvim/plugged/neotest/lua/neotest/client/runner.lua:89: in function <...share/nvim/plugged/neotest/lua/neotest/client/runner.lua:88>

Reverting back to 2148ad794e7a5c30c7385a3281f4be91e6b113c4 and executing against the same function I get the proper failed test output.

I was able to reproduce the error with a simple testcase

package main

import "testing"

func TestStackTrace(t *testing.T) {
        t.FailNow()
}

Testing that function with b6dc0b1c49569273d863d7b96b6c81b3fc153e82 will throw a stacktrace while testing with 2148ad794e7a5c30c7385a3281f4be91e6b113c4 correctly reports the error.

sergii4 commented 1 year ago

Hi @zankich, I could reproduce it only once from 10 attempts. Do you have clean steps to reproduce?

Snikimonkd commented 1 year ago

i have the same problem on every call of require("neotest").run.run(), i don't know how to check plugin's commit, but i tried to update it with :PackerSync, so i can assume that this problem reproduces with the latest versions of neotest and neotest-go

UPD tried with 3 last tags of neotest - reproduces on all tags

zankich commented 1 year ago

I got a PR which fixed the issues for me https://github.com/nvim-neotest/neotest-go/pull/49

sergii4 commented 1 year ago

Hi @zankich, I believe @michaldziurowski fixed issue in #48. Could you please update plugin and test if it works on your side?

tauraamui commented 1 year ago

How can I update the neotest-go runner specifically? I am also experiencing this bug and I would like to acquire the fix. Oh I see, it's just its own plugin entry. I suppose I'll have to reload my neovim instance to see the fix has applied.