Skip to content

Commit

Permalink
update with suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
allansson committed Aug 20, 2024
1 parent a0a3fb0 commit 3bbc11d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
19 changes: 9 additions & 10 deletions docs/sources/next/javascript-api/jslib/utils/check.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
---
title: 'check( val, sets, [tags] )'
description: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
description: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
description: 'The jslib check function runs one or more checks on a value and generates a pass/fail result, but does not throw errors or interrupt test execution upon failure. It supports async values.'
---

# check( val, sets, [tags] )

This is a drop-in replacement for the built-in [check](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6/check/) with support for async values. Any `Promise`s will be awaited and the result will be reported once the operation has completed.
The `check` function is a drop-in replacement for the built-in [check](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6/check/), with added support for async values. Any `Promise`s will be awaited, and the result is reported once the operation has been completed.

| Parameter | Type | Description |
| --------------- | ---------------------- | ---------------------------------------------------------------------------------------- |
| val | any | Value to test. |
| sets | Record<string, any> | Tests (checks) to run on the value. Functions will be called. `Promise`s will be awaited |
| tags (optional) | Record<string, string> | Extra tags to attach to metrics emitted. |
| Parameter | Type | Description |
| --------------- | ---------------------- | ----------------------------------------------------------------------------------------- |
| val | any | Value to test. |
| sets | Record<string, any> | Tests (checks) to run on the value. Functions will be called. `Promise`s will be awaited. |
| tags (optional) | Record<string, string> | Extra tags to attach to metrics emitted. |

### Returns

| Type | Description |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Promise<boolean> | boolean | `true` if all checks have succeeded, `false` otherwise. If any of the checked values was a `Promise`, the result will be wrapped in a `Promise`. |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Promise<boolean> | boolean | `true` if all checks have succeeded, `false` otherwise. If any of the checked values was a `Promise`, the result is wrapped in a `Promise`. |

### Examples

Expand Down
19 changes: 9 additions & 10 deletions docs/sources/v0.53.x/javascript-api/jslib/utils/check.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
---
title: 'check( val, sets, [tags] )'
description: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
description: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
description: 'The jslib check function runs one or more checks on a value and generates a pass/fail result, but does not throw errors or interrupt test execution upon failure. It supports async values.'
---

# check( val, sets, [tags] )

This is a drop-in replacement for the built-in [check](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6/check/) with support for async values. Any `Promise`s will be awaited and the result will be reported once the operation has completed.
The `check` function is a drop-in replacement for the built-in [check](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6/check/), with added support for async values. Any `Promise`s will be awaited, and the result is reported once the operation has been completed.

| Parameter | Type | Description |
| --------------- | ---------------------- | ---------------------------------------------------------------------------------------- |
| val | any | Value to test. |
| sets | Record<string, any> | Tests (checks) to run on the value. Functions will be called. `Promise`s will be awaited |
| tags (optional) | Record<string, string> | Extra tags to attach to metrics emitted. |
| Parameter | Type | Description |
| --------------- | ---------------------- | ----------------------------------------------------------------------------------------- |
| val | any | Value to test. |
| sets | Record<string, any> | Tests (checks) to run on the value. Functions will be called. `Promise`s will be awaited. |
| tags (optional) | Record<string, string> | Extra tags to attach to metrics emitted. |

### Returns

| Type | Description |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Promise<boolean> | boolean | `true` if all checks have succeeded, `false` otherwise. If any of the checked values was a `Promise`, the result will be wrapped in a `Promise`. |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Promise<boolean> | boolean | `true` if all checks have succeeded, `false` otherwise. If any of the checked values was a `Promise`, the result is wrapped in a `Promise`. |

### Examples

Expand Down

0 comments on commit 3bbc11d

Please sign in to comment.