-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add docs for new async check function in k6-utils #1694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just made some small edits, everything else looks good. Thanks for adding this to the docs! 🤓
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.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.' |
Removing the duplicate description, and some small edits to it. I think it's useful for us to add the async support here.
|
||
# 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| sets | Record<string, any> | Tests (checks) to run on the value. Functions will be called. `Promise`s will be awaited | | |
| sets | Record<string, any> | Tests (checks) to run on the value. Functions will be called. `Promise`s will be awaited. | |
|
||
| 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`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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`. | |
What?
This PR documents the new async check function in k6-utils.
Checklist
npm start
command locally and verified that the changes look good.docs/sources/next
folder of the documentation.docs/sources/v{most_recent_release}
folder of the documentation.Related PR(s)/Issue(s)
Issue: grafana/jslib.k6.io#125