Skip to content

Commit 4a2c832

Browse files
committedJan 11, 2024
add GinkgoTB() to docs
1 parent 92b6744 commit 4a2c832

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed
 

‎docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5420,7 +5420,7 @@ ginkgo version
54205420
54215421
### Using Third-party Libraries
54225422
5423-
Most third-party Go `testing` integrations (e.g. matcher libraries, mocking libraries) take and wrap a `*testing.T` to provide functionality. Unfortunately there is no formal interface for `*testing.T` however Ginkgo provides a function, `GinkgoT()` that returns a struct that implements all the methods that `*testing.T` implements. Most libraries accept the `*testing.T` object via an interface and you can usually simply pass in `GinkgoT()` and expect the library to work.
5423+
Most third-party Go `testing` integrations (e.g. matcher libraries, mocking libraries) take and wrap a `*testing.T` to provide functionality. Unfortunately there is no formal interface for `*testing.T` however Ginkgo provides a function, `GinkgoT()` that returns a struct that implements all the methods that `*testing.T` implements. Most libraries accept the `*testing.T` object via an interface and you can usually simply pass in `GinkgoT()` and expect the library to work. Some libraries require passing in a `testing.TB` - you can use `GinkgoTB()` for these.
54245424
54255425
For example, you can choose to use [testify](https://github.com/stretchr/testify) instead of Gomega like so:
54265426

‎ginkgo_t_dsl.go

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ This wrapper satisfies the testing.TB interface and intended to be used as a dro
106106
Similar to GinkgoT(), GinkgoTB() takes an optional offset argument that can be used to get the
107107
correct line number associated with the failure - though you do not need to use this if you call GinkgoHelper() or GinkgoT().Helper() appropriately
108108
*/
109-
110109
func GinkgoTB(optionalOffset ...int) *GinkgoTBWrapper {
111110
offset := 2
112111
if len(optionalOffset) > 0 {

0 commit comments

Comments
 (0)
Please sign in to comment.