Skip to content

Commit

Permalink
Update group page to include link to utils check function (#1803)
Browse files Browse the repository at this point in the history
* Update group page to include link to utils check function

This link is referenced from a k6 error message when using the check function, and it now includes a link to where users can find the correct information.

* Remove duplicate description

* Apply to v0.54 and v0.53
  • Loading branch information
heitortsergent authored Nov 7, 2024
1 parent 27a5d99 commit 7f61b5a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
19 changes: 13 additions & 6 deletions docs/sources/k6/next/javascript-api/k6/group.md
Original file line number Diff line number Diff line change
@@ -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/<K6_VERSION>/javascript-api/jslib/utils/check/).

{{< /admonition >}}

Run code inside a group. Groups are used to organize results in a test.

| Parameter | Type | Description |
Expand All @@ -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

Expand Down
19 changes: 13 additions & 6 deletions docs/sources/k6/v0.53.x/javascript-api/k6/group.md
Original file line number Diff line number Diff line change
@@ -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/<K6_VERSION>/javascript-api/jslib/utils/check/).

{{< /admonition >}}

Run code inside a group. Groups are used to organize results in a test.

| Parameter | Type | Description |
Expand All @@ -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

Expand Down
19 changes: 13 additions & 6 deletions docs/sources/k6/v0.54.x/javascript-api/k6/group.md
Original file line number Diff line number Diff line change
@@ -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/<K6_VERSION>/javascript-api/jslib/utils/check/).

{{< /admonition >}}

Run code inside a group. Groups are used to organize results in a test.

| Parameter | Type | Description |
Expand All @@ -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

Expand Down

0 comments on commit 7f61b5a

Please sign in to comment.