Skip to content

Commit

Permalink
add GinkgoTB() to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
onsi committed Jan 11, 2024
1 parent 92b6744 commit 4a2c832
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Expand Up @@ -5420,7 +5420,7 @@ ginkgo version
### Using Third-party Libraries
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.
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.
For example, you can choose to use [testify](https://github.com/stretchr/testify) instead of Gomega like so:
Expand Down
1 change: 0 additions & 1 deletion ginkgo_t_dsl.go
Expand Up @@ -106,7 +106,6 @@ This wrapper satisfies the testing.TB interface and intended to be used as a dro
Similar to GinkgoT(), GinkgoTB() takes an optional offset argument that can be used to get the
correct line number associated with the failure - though you do not need to use this if you call GinkgoHelper() or GinkgoT().Helper() appropriately
*/

func GinkgoTB(optionalOffset ...int) *GinkgoTBWrapper {
offset := 2
if len(optionalOffset) > 0 {
Expand Down

0 comments on commit 4a2c832

Please sign in to comment.