Skip to content

Commit 24e958d

Browse files
luistmonsi
authored andcommittedJan 19, 2024
Show how to import the format sub package
I find this useful for developers that are less familiar with Go and Gomega.
1 parent ad1a367 commit 24e958d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎docs/index.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,13 @@ to be false
215215

216216
When a failure occurs, Gomega prints out a recursive description of the objects involved in the failed assertion. This output can be very verbose, but Gomega's philosophy is to give as much output as possible to aid in identifying the root cause of a test failure.
217217

218-
These recursive object renditions are performed by the `format` subpackage. `format` provides some globally adjustable settings to tune Gomega's output:
218+
These recursive object renditions are performed by the `format` subpackage. Import the format subpackage in your test code:
219+
220+
```go
221+
import "github.com/onsi/gomega/format"
222+
```
223+
224+
`format` provides some globally adjustable settings to tune Gomega's output:
219225

220226
- `format.MaxLength = 4000`: Gomega will recursively traverse nested data structures as it produces output. If the length of this string representation is more than MaxLength, it will be truncated to MaxLength. To disable this behavior, set the MaxLength to `0`.
221227
- `format.MaxDepth = 10`: Gomega will recursively traverse nested data structures as it produces output. By default the maximum depth of this recursion is set to `10` you can adjust this to see deeper or shallower representations of objects.

0 commit comments

Comments
 (0)
Please sign in to comment.