GithubHelp home page GithubHelp logo

Comments (6)

tkrause avatar tkrause commented on August 10, 2024

I'm also seeing this but with a very cryptic error about a nil pointer in a coroutine.

Seems to happen with subtests consistently where I have multiple levels of subtests.

          if not tests[testname].file_output[testfile] then
            tests[testname].file_output[testfile] = {}
          end

          if not tests[testname].file_output[testfile][linenumber] then
            tests[testname].file_output[testfile][linenumber] = {}
          end

In that same file, at least keeps it from crashing. But this seems like a bigger issue with parsing subtests.

from neotest-go.

fredrikaverpil avatar fredrikaverpil commented on August 10, 2024

I am also seeing an error around marshal_gotest_output when using nested tests that might be using t.Skip():

   Warn  10:59:47 notify.warn Neotest neotest-go: ...edrik/.local/share/LazyVim/lazy/neotest/lua/nio/init.lua:105: The coroutine failed with this message: 
.../share/LazyVim/lazy/neotest-go/lua/neotest-go/output.lua:82: attempt to index a nil value
stack traceback:
	.../share/LazyVim/lazy/neotest-go/lua/neotest-go/output.lua: in function 'marshal_gotest_output'
	...al/share/LazyVim/lazy/neotest-go/lua/neotest-go/init.lua:214: in function 'results'
	...share/LazyVim/lazy/neotest/lua/neotest/client/runner.lua:132: in function '_run_spec'
	...share/LazyVim/lazy/neotest/lua/neotest/client/runner.lua:89: in function <...share/LazyVim/lazy/neotest/lua/neotest/client/runner.lua:88>

In my case I have a test looking like this:

func TestAddSubTestLevelSkipping(t *testing.T) {
	for _, skip := range []bool{true, false} {
		t.Run("Subtest1", func(t *testing.T) {
			t.Run("Subtest2", func(t *testing.T) {
				if !skip {
					t.Skip("skipping test")
				}
			})
		})
	}
}

It works fine on the commandline:

go test -timeout 30s -v -run ^TestAddSubTestLevelSkipping$ yolo/cmd
=== RUN   TestAddSubTestLevelSkipping
=== RUN   TestAddSubTestLevelSkipping/Subtest1
=== RUN   TestAddSubTestLevelSkipping/Subtest1/Subtest2
=== RUN   TestAddSubTestLevelSkipping/Subtest1#01
=== RUN   TestAddSubTestLevelSkipping/Subtest1#01/Subtest2
    app_test.go:42: skipping test
--- PASS: TestAddSubTestLevelSkipping (0.00s)
    --- PASS: TestAddSubTestLevelSkipping/Subtest1 (0.00s)
        --- PASS: TestAddSubTestLevelSkipping/Subtest1/Subtest2 (0.00s)
    --- PASS: TestAddSubTestLevelSkipping/Subtest1#01 (0.00s)
        --- SKIP: TestAddSubTestLevelSkipping/Subtest1#01/Subtest2 (0.00s)
PASS

What's interesting here is that by removing the ! in front of skip, the test passes without issues in neotest-go:

-				if !skip {
+				if skip {

Could it be that neotest-go doesn't properly parse the /#01/ in the path TestAddSubTestLevelSkipping/Subtest1#01/Subtest2?

Also, note that the second subtest (Subtest2) is also subject to this bug: #52

from neotest-go.

fredrikaverpil avatar fredrikaverpil commented on August 10, 2024

I added a reproducible example here:

from neotest-go.

sergii4 avatar sergii4 commented on August 10, 2024

@MortenGerdes could you please update and check now?

from neotest-go.

fredrikaverpil avatar fredrikaverpil commented on August 10, 2024

I can confirm I no longer get the marshal_gotest_output error I reported here on my end anymore. 🎉

from neotest-go.

MortenGerdes avatar MortenGerdes commented on August 10, 2024

@sergii4 Seems fixed on my end after your update. I had two places where I ran into the issue and both are now working 🙌

Great work!

from neotest-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.