ginkgoTestExplorer icon indicating copy to clipboard operation
ginkgoTestExplorer copied to clipboard

Cannot run tests when the root container is "When", but it works for its aliases ("Context" and "Describe")

Open MaximeWeyl opened this issue 1 year ago • 0 comments

When the top container is a "When", the extension does not work. There is this error in the console :

Checking the Ginkgo executable was installed.
Ginkgo executable already installed. ;)
Checking the Ginkgo executable was installed.
Could not populate the outline view: TypeError: Cannot read properties of undefined (reading 'name')
Ginkgo executable already installed. ;)
Checking the Ginkgo executable was installed.
Could not populate the outline view: TypeError: Cannot read properties of undefined (reading 'name')
Ginkgo executable already installed. ;)
Checking the Ginkgo executable was installed.
Could not populate the outline view: TypeError: Cannot read properties of undefined (reading 'name')
Ginkgo executable already installed. ;)
Checking the Ginkgo executable was installed.
Could not populate the outline view: TypeError: Cannot read properties of undefined (reading 'name')
Ginkgo executable already installed. ;)

But it works fine with "Context" and "Describe", which are aliases for "When".

Reproduction

This file demonstrates the problem :

package hive_test

import (
	"testing"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
)

func TestHive(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Hive Suite")
}

var _ = When("Demo", func() {
	var s string

	BeforeEach(func() {
		s = "test"
	})

	It("should work with the extension", func() {
		Expect(s).To(Equal("test"))
	})
})

image

MaximeWeyl avatar Jun 20 '24 15:06 MaximeWeyl