Skip to content

Sub-tests do not show source of error in Test explorer view #1837

@ghost

Description

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.17.1 linux/amd6
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.7.2
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.61.0 (VS Codium)
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.28.1

Share the Go related settings you have added/edited

Describe the bug

VS Code/Codium has a Test Explorer View. Usually test failures (source code line) are highlighted and there is a peek for any given failure.

In case one uses sub-tests e.g. t.Run(...) scope - this functionality of highlighting source code line responsible of failure is gone.

Steps to reproduce the behaviour:

Example code to demonstrate the issue:

package main

import "testing"

func Test_FailurePeeksInTestExplorer(t *testing.T) {
	t.Error("A test failure")
}

func Test_NoPeekInTestExplorer(t *testing.T) {
	t.Run("Should have peek to failure in test explorer", func(t *testing.T) {
		t.Error("A test failure")
	})
}

func Test_AnotherFailurePeeksInTestExplorer(t *testing.T) {
	t.Error("Another test failure")
}

Screenshots or recordings

image

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeHelpWantedIssues that are not prioritized by the maintainers. Help is requested from community contributors.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions