You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/index.md
+11-1
Original file line number
Diff line number
Diff line change
@@ -5081,7 +5081,17 @@ will generate a file named `PACKAGE_suite_test.go` and
5081
5081
ginkgo generate <SUBJECT>
5082
5082
```
5083
5083
5084
-
will generate a file named `SUBJECT_test.go` (or `PACKAGE_test.go` if `<SUBJECT>` is not provided). Both generators support custom templates using `--template`. Take a look at the [Ginkgo's CLI code](https://github.com/onsi/ginkgo/tree/master/ginkgo/ginkgo/generators) to see what's available in the template.
5084
+
will generate a file named `SUBJECT_test.go` (or `PACKAGE_test.go` if `<SUBJECT>` is not provided). Both generators support custom templates using `--template`
5085
+
and the option to provide extra custom data to be rendered into the template, besides the default values, using `--template-data`. The custom data should be a well structured JSON file. When loaded into the template the custom data will be available to access from the global key `.CustomData`. For example,
5086
+
with a JSON file
5087
+
```json
5088
+
{ "suitename": "E2E",
5089
+
"labels": ["fast", "parallel", "component"]}
5090
+
```
5091
+
The custom data can be accessed like so:
5092
+
`{{ .CustomData.suitename }}` or `{{ range .CustomData.labels }} {{.}} {{ end }}`
5093
+
5094
+
Take a look at the [Ginkgo's CLI code](https://github.com/onsi/ginkgo/tree/master/ginkgo/ginkgo/generators) to see what's available in the template.
0 commit comments