-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testify test suite test cases are not recognized, if import is missing in file #899
Comments
@breml Thanks for reporting the issue. The check for import statement was added because of the issue reported in microsoft/vscode-go/issues/1911. Unfortunately, the testify suite detection is done in the documentation level ( Lines 130 to 166 in 8e1dadd
And it uses only the pattern matching on the symbol name. An ideal scenario is to ask gopls to provide symbol information accompanied with the type information, but I am not sure if we can achieve that with the standard LSP methods. (@stamblerre @suzmue) |
I'm also having the same issue. Can this issue be resolved? It seems like it's been quite a while. |
Right now, the extension essentially looks at the file and asks, "Does this look like a test?" It has no knowledge of types or anything like that. This is done purely at the syntax layer. Due to these limitations, as long as test discovery is handled syntactically, I expect this issue to remain. We have discussed moving test detection into |
Describe the bug
With the introduction of microsoft/vscode-go#1707, support for running and debugging individual test methods for instances which use github.com/stretchr/testify/suite interfaces has been added to vscode-go.
To me it looks like this support has added only partially, because for me it only works, if the specific Go test file does include the import for "github.com/stretchr/testify/suite". If this is not the case, the commands "run test | debug test" are not shown.
Consider this setup (with two files in the same directory/package):
testify_test.go:
testify_test2.go
In this case, the commands "run test | debug test" are show in the file testify_test.go for the method
TestFoo1
. But the same is not the case for the methodTestFoo2
in the file testify_test2.go.The problem can be resolved by adding the following import statement to testify_test2.go:
Screenshots
Without import:
With import:
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gogo version go1.15.1 linux/amd64
code -v
orcode-insiders -v
to get version of VS Code or VS Code InsidersThe text was updated successfully, but these errors were encountered: