diff --git a/docs/sources/k6/next/javascript-api/k6/group.md b/docs/sources/k6/next/javascript-api/k6/group.md index 3038357e9..adac288fc 100644 --- a/docs/sources/k6/next/javascript-api/k6/group.md +++ b/docs/sources/k6/next/javascript-api/k6/group.md @@ -1,11 +1,16 @@ --- title: 'group( name, fn )' description: 'Runs code inside a group. Used to organize results in a test.' -description: 'Runs code inside a group. Used to organize results in a test.' --- # group( name, fn ) +{{< admonition type="note" >}} + +For details about using the `check()` function with async values, refer to the jslib utils [check](https://grafana.com/docs/k6//javascript-api/jslib/utils/check/). + +{{< /admonition >}} + Run code inside a group. Groups are used to organize results in a test. | Parameter | Type | Description | @@ -19,18 +24,20 @@ Run code inside a group. Groups are used to organize results in a test. | ---- | ------------------------- | | any | The return value of _fn_. | +## Limitations + {{< admonition type="warning" >}} Avoid using `group` with async functions or asynchronous code. -If you do, k6 might apply tags in a way that is unreliable or unintuitive. +If you do, k6 might apply tags in an unreliable or unintuitive way. -If you start promise chains or even use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be. +{{< /admonition >}} -To avoid confusion, `async` functions are forbidden as `group()` arguments. This still lets users make and chain promises within a group, but doing so is unsupported and not recommended. +If you start promise chains or use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be. -For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. +To avoid confusion, `async` functions are forbidden as `group()` arguments. That still lets users make and chain promises within a group, but doing so is unsupported and not recommended. -{{< /admonition >}} +For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. ### Example diff --git a/docs/sources/k6/v0.53.x/javascript-api/k6/group.md b/docs/sources/k6/v0.53.x/javascript-api/k6/group.md index 3038357e9..adac288fc 100644 --- a/docs/sources/k6/v0.53.x/javascript-api/k6/group.md +++ b/docs/sources/k6/v0.53.x/javascript-api/k6/group.md @@ -1,11 +1,16 @@ --- title: 'group( name, fn )' description: 'Runs code inside a group. Used to organize results in a test.' -description: 'Runs code inside a group. Used to organize results in a test.' --- # group( name, fn ) +{{< admonition type="note" >}} + +For details about using the `check()` function with async values, refer to the jslib utils [check](https://grafana.com/docs/k6//javascript-api/jslib/utils/check/). + +{{< /admonition >}} + Run code inside a group. Groups are used to organize results in a test. | Parameter | Type | Description | @@ -19,18 +24,20 @@ Run code inside a group. Groups are used to organize results in a test. | ---- | ------------------------- | | any | The return value of _fn_. | +## Limitations + {{< admonition type="warning" >}} Avoid using `group` with async functions or asynchronous code. -If you do, k6 might apply tags in a way that is unreliable or unintuitive. +If you do, k6 might apply tags in an unreliable or unintuitive way. -If you start promise chains or even use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be. +{{< /admonition >}} -To avoid confusion, `async` functions are forbidden as `group()` arguments. This still lets users make and chain promises within a group, but doing so is unsupported and not recommended. +If you start promise chains or use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be. -For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. +To avoid confusion, `async` functions are forbidden as `group()` arguments. That still lets users make and chain promises within a group, but doing so is unsupported and not recommended. -{{< /admonition >}} +For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. ### Example diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6/group.md b/docs/sources/k6/v0.54.x/javascript-api/k6/group.md index 3038357e9..adac288fc 100644 --- a/docs/sources/k6/v0.54.x/javascript-api/k6/group.md +++ b/docs/sources/k6/v0.54.x/javascript-api/k6/group.md @@ -1,11 +1,16 @@ --- title: 'group( name, fn )' description: 'Runs code inside a group. Used to organize results in a test.' -description: 'Runs code inside a group. Used to organize results in a test.' --- # group( name, fn ) +{{< admonition type="note" >}} + +For details about using the `check()` function with async values, refer to the jslib utils [check](https://grafana.com/docs/k6//javascript-api/jslib/utils/check/). + +{{< /admonition >}} + Run code inside a group. Groups are used to organize results in a test. | Parameter | Type | Description | @@ -19,18 +24,20 @@ Run code inside a group. Groups are used to organize results in a test. | ---- | ------------------------- | | any | The return value of _fn_. | +## Limitations + {{< admonition type="warning" >}} Avoid using `group` with async functions or asynchronous code. -If you do, k6 might apply tags in a way that is unreliable or unintuitive. +If you do, k6 might apply tags in an unreliable or unintuitive way. -If you start promise chains or even use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be. +{{< /admonition >}} -To avoid confusion, `async` functions are forbidden as `group()` arguments. This still lets users make and chain promises within a group, but doing so is unsupported and not recommended. +If you start promise chains or use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be. -For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. +To avoid confusion, `async` functions are forbidden as `group()` arguments. That still lets users make and chain promises within a group, but doing so is unsupported and not recommended. -{{< /admonition >}} +For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations. ### Example