Skip to content

Testing deeper sub tests result in no test run #2719

Closed as not planned
Closed as not planned
@emilhem

Description

@emilhem

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.20.2 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
Build info
----------
golang.org/x/tools/gopls v0.11.0
    golang.org/x/tools/[email protected] h1:/nvKHdTtePQmrv9XN3gIUN9MOdUrKzO/dcqgbG6x8EY=
    github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/[email protected] h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE=
    golang.org/x/exp/[email protected] h1:fl8k2zg28yA23264d82M4dp+YlJ3ngDcpuB1bewkQi4=
    golang.org/x/[email protected] h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
    golang.org/x/[email protected] h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
    golang.org/x/[email protected] h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
    golang.org/x/[email protected] h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
    golang.org/x/[email protected] h1:7/HkGkN/2ktghBCSRRgp31wAww4syfsW52tj7yirjWk=
    golang.org/x/[email protected] h1:qptQiQwEpETwDiz85LKtChqif9xhVkAm8Nhxs0xnTww=
    honnef.co/go/[email protected] h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA=
    mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.20.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
1.77.0
7f329fe6c66b0f86ae1574c2911b681ad5a45d63
x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.38.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Checking configured tools....
GOBIN: undefined
toolsGopath: 
gopath: /home/emil.hemdal/go
GOROOT: /home/linuxbrew/.linuxbrew/Cellar/go/1.20.2/libexec
PATH: /home/emil.hemdal/.local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/emil.hemdal/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

	go:	/home/linuxbrew/.linuxbrew/bin/go: go version go1.20.2 linux/amd64

	gotests:	/home/emil.hemdal/go/bin/gotests	(version: v1.6.0 built with go: go1.20.1)
	gomodifytags:	/home/emil.hemdal/go/bin/gomodifytags	(version: v1.16.0 built with go: go1.20.1)
	impl:	/home/emil.hemdal/go/bin/impl	(version: v1.1.0 built with go: go1.20.1)
	goplay:	/home/emil.hemdal/go/bin/goplay	(version: v1.0.0 built with go: go1.20.1)
	dlv:	/home/emil.hemdal/go/bin/dlv	(version: v1.20.1 built with go: go1.20.1)
	staticcheck:	/home/emil.hemdal/go/bin/staticcheck	(version: v0.4.2 built with go: go1.20.1)
	gopls:	/home/emil.hemdal/go/bin/gopls	(version: v0.11.0 built with go: go1.20.2)

go env
Workspace Folder (snip): /home/emil.hemdal/dev/snip
	GO111MODULE=""
	GOARCH="amd64"
	GOBIN=""
	GOCACHE="/home/emil.hemdal/.cache/go-build"
	GOENV="/home/emil.hemdal/.config/go/env"
	GOEXE=""
	GOEXPERIMENT=""
	GOFLAGS=""
	GOHOSTARCH="amd64"
	GOHOSTOS="linux"
	GOINSECURE=""
	GOMODCACHE="/home/emil.hemdal/go/pkg/mod"
	GONOPROXY=""
	GONOSUMDB=""
	GOOS="linux"
	GOPATH="/home/emil.hemdal/go"
	GOPRIVATE=""
	GOPROXY="https://proxy.golang.org,direct"
	GOROOT="/home/linuxbrew/.linuxbrew/Cellar/go/1.20.2/libexec"
	GOSUMDB="sum.golang.org"
	GOTMPDIR=""
	GOTOOLDIR="/home/linuxbrew/.linuxbrew/Cellar/go/1.20.2/libexec/pkg/tool/linux_amd64"
	GOVCS=""
	GOVERSION="go1.20.2"
	GCCGO="gccgo"
	GOAMD64="v1"
	AR="ar"
	CC="gcc-11"
	CXX="g++-11"
	CGO_ENABLED="1"
	GOMOD="/home/emil.hemdal/dev/snip/go.mod"
	GOWORK=""
	CGO_CFLAGS="-O2 -g"
	CGO_CPPFLAGS=""
	CGO_CXXFLAGS="-O2 -g"
	CGO_FFLAGS="-O2 -g"
	CGO_LDFLAGS="-O2 -g"
	PKG_CONFIG="pkg-config"
	GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3467527775=/tmp/go-build -gno-record-gcc-switches"

Share the Go related settings you have added/edited

    "go.formatTool": "gofmt",

Describe the bug

Clicking run test on a sub level test in VS Code results in testing: warning: no tests to run.

What I expect to happen is that the test should run.

Running the tests using the terminal works (i.e. go test -run=TestingTheTester/2/3 example.com/testingthetester/test)

Steps to reproduce the behavior:

  1. Create an empty project and add a test directory
  2. Add a test file there (like testingthe_test.go)
  3. Add the following content
package testingthetester_test

import (
	"testing"
)

func TestTestingTheTester(t *testing.T) {
	t.Log("Level 1")
	t.Run("2", func(t *testing.T) {
		t.Log("Level 2")
		t.Run("3", func(t *testing.T) {
			t.Log("Level 3")
			t.Fatalf("Failing level 3")
		})
		t.Fatalf("Failing level 2")
	})
	t.Fatalf("Failing level 1")
}
  1. Run the inner most test using the run test "middle thingy"

Screenshots or recordings

Screencast.from.2023-04-03.11.48.22.webm

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgego-testissues related to go test support (test output, test explorer, ...)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions