github.com/onsi/ginkgo@v1.16.6-0.20211118180735-4e1925ba4c95/ginkgo_t_dsl.go (about) 1 package ginkgo 2 3 import "github.com/onsi/ginkgo/internal/testingtproxy" 4 5 /* 6 GinkgoT() implements an interface analogous to *testing.T and can be used with 7 third-party libraries that accept *testing.T through an interface. 8 9 GinkgoT() takes an optional offset argument that can be used to get the 10 correct line number associated with the failure. 11 12 You can learn more here: https://onsi.github.io/ginkgo/#using-third-party-libraries 13 */ 14 func GinkgoT(optionalOffset ...int) GinkgoTInterface { 15 offset := 3 16 if len(optionalOffset) > 0 { 17 offset = optionalOffset[0] 18 } 19 return testingtproxy.New(GinkgoWriter, Fail, Skip, DeferCleanup, CurrentSpecReport, offset) 20 } 21 22 /* 23 The interface returned by GinkgoT(). This covers most of the methods in the testing package's T. 24 */ 25 type GinkgoTInterface interface { 26 Cleanup(func()) 27 Setenv(kev, value string) 28 Error(args ...interface{}) 29 Errorf(format string, args ...interface{}) 30 Fail() 31 FailNow() 32 Failed() bool 33 Fatal(args ...interface{}) 34 Fatalf(format string, args ...interface{}) 35 Helper() 36 Log(args ...interface{}) 37 Logf(format string, args ...interface{}) 38 Name() string 39 Parallel() 40 Skip(args ...interface{}) 41 SkipNow() 42 Skipf(format string, args ...interface{}) 43 Skipped() bool 44 TempDir() string 45 }