Comments (6)
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.
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.
I added a reproducible example here:
- Screenshot, links: https://github.com/fredrikaverpil/go-playground/blob/main/bugs/neotest-go/README.md#crash-in-marshal_gotest_output
- Go test code: https://github.com/fredrikaverpil/go-playground/blob/main/bugs/neotest-go/marshaloutput_test.go
from neotest-go.
@MortenGerdes could you please update and check now?
from neotest-go.
I can confirm I no longer get the marshal_gotest_output error I reported here on my end anymore. 🎉
from neotest-go.
@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)
- [feature request] Table-driven tests written as map[string]struct{} HOT 5
- Neotest Summary window is showing incorrect status HOT 2
- nil error on test single function HOT 5
- Error while testing a file/directory with failed test cases HOT 1
- 'No tests found' using minimal config HOT 40
- Test Output in JSON, making it difficult to read HOT 30
- Tests having warnings are marked as failed HOT 2
- Test coverage generation is not working properly due to cwd being changed to the test file directory. HOT 9
- Running package tests HOT 4
- Query: invalid structure at position 1288 for language go
- how to add test binary flags
- Cannot run spec tests HOT 3
- No Tests Found HOT 2
- Neotest-go not compatible with Go provided via pkgx HOT 1
- cannot run unit tests HOT 1
- neotest-go adapter being used for typescript files when repo has both typescript and go HOT 1
- Feat - Add Support for Nested Subtests
- Feature request: Add diagnostics for table tests. HOT 2
- "Run nearest" runs all tests HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neotest-go.