onsi / ginkgo

A Modern Testing Framework for Go
http://onsi.github.io/ginkgo/
MIT License
8.12k stars 644 forks source link

GinkgoT: does not skip internal code by default #1330

Open pohly opened 6 months ago

pohly commented 6 months ago

Reproducer:

var _ = ginkgo.Describe("something", func() {
    ginkgo.It("fails", func(ctx context.Context) {
        ginkgo.GinkgoT().Fatal("this failure is intentional")
    })
})

Output:

[FAILED] this failure is intentional

  In [It] at: /nvme/gopath/src/k8s.io/kubernetes/vendor/github.com/onsi/ginkgo/v2/internal/suite.go:889 @ 01/03/24 12:02:50.498

It works when using ginkgo.GinkgoT(1).

Either that should be the default or stack unwinding needs to know that it can skip ginkgo/v2/internal.

ebabani commented 6 months ago

This should be fixed in #1333