Skip to content

Testify sub-tests are not detected to run/debug #4000

@bmviniciuss

Description

@bmviniciuss

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.

    • go version go1.26.1 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.

    • golang.org/x/tools/gopls v0.21.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.

    • 1.111.0 ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb x64
  • Check your installed extensions to get the version of the VS Code Go extension

    • 0.52.2
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    GOBIN: /home/bmviniciuss/.asdf/installs/golang/1.26.1/bin
    toolsGopath:
    gopath: /home/bmviniciuss/.asdf/installs/golang/1.26.1/packages
    GOROOT: /home/bmviniciuss/.asdf/installs/golang/1.26.1/go
    PATH: /home/bmviniciuss/.asdf/installs/golang/1.26.1/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    PATH (vscode launched with): /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

    go: /home/bmviniciuss/.asdf/installs/golang/1.26.1/go/bin/go: go version go1.26.1 linux/amd64

    gotests: not installed
    impl: not installed
    goplay: not installed
    dlv: not installed
    gopls: /home/bmviniciuss/.asdf/installs/golang/1.26.1/bin/gopls (version: v0.21.1 built with go: go1.26.1)

Workspace Folder (teste): /home/bmviniciuss/Repos/teste

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/home/bmviniciuss/.asdf/installs/golang/1.26.1/bin'
GOCACHE='/home/bmviniciuss/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/bmviniciuss/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build358917866=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/bmviniciuss/Repos/teste/go.mod'
GOMODCACHE='/home/bmviniciuss/.asdf/installs/golang/1.26.1/packages/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/bmviniciuss/.asdf/installs/golang/1.26.1/packages'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/bmviniciuss/.asdf/installs/golang/1.26.1/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/bmviniciuss/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/bmviniciuss/.asdf/installs/golang/1.26.1/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26.1'
GOWORK=''
PKG_CONFIG='pkg-config'

Share the Go related settings you have added/edited

Brand new install of vscode with vscode-go extension.

Describe the bug

With the code example bellow the extension does not identify the testify subtests (B.1 and B.2) as runnable on the left.

Image

Steps to reproduce the behavior:

package example_test

import (
	"testing"

	"github.com/stretchr/testify/suite"
)

type Suite struct {
	suite.Suite
}

func TestSuite(t *testing.T) {
	suite.Run(t, new(Suite))
}

func (s *Suite) TestA() {
	s.Require().True(true)
}

func (s *Suite) TestB() {
	s.Run("B.1", func() {
		s.Require().True(true)
	})

	s.Run("B.2", func() {
		s.Require().True(false)
	})
}

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions