Description
Starting from at least 0.6.90, tests bound to testify suites aren't detected by the vscode-go extension. Thus neither codelens or the "Test function at cursor" work anymore for this kind of test.
I also found a second issue while debugging the extension, which drove me crazy because it made the example suite from the testify github page work and show codelenses. The testFuncRegex
is missing a ^
in front of Example
, which makes the extension treat (suite *ExampleTestSuite) TestExample()
like a regular test function, because it includes Example
Last, it should be documented somewhere that even with the fix in #1969 , users need to include "go.gotoSymbol.includeImports": true
in their settings for testify to be properly detected.
Steps to Reproduce:
- Open vscode with the extension enabled and create a test file with the code below
- Try looking for codelenses and try "Test function at cursor"
package example
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
type Suite struct {
suite.Suite
VariableThatShouldStartAtFive int
}
func (suite *Suite) TestExample() {
assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive)
}
func TestSuite(t *testing.T) {
suite.Run(t, new(Suite))
}
Edit: fix for both issues in #1969
Activity