-
Notifications
You must be signed in to change notification settings - Fork 220
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
Use async check
instead of the sync one
#1746
Conversation
e00bbe1
to
01b3157
Compare
The changes look good to me, I'll wait until someone else on the development team takes a look. 🤓 Also, good catch on the |
@heitortsergent Thanks for your review!
❤️ Of course!
Sure, please feel free :) Just for heads-up, anything above k6 0.52 must have |
@heitortsergent In addition to your commit, I've also added another that fixes the ones in v51 and below. |
Co-authored-by: Heitor Tashiro Sergent <[email protected]>
b977c76
to
2384d28
Compare
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.
Thanks for this change 😄
Left some suggestions that might need to be looked at.
docs/sources/next/javascript-api/k6-browser/page/waitforfunction.md
Outdated
Show resolved
Hide resolved
docs/sources/v0.52.x/javascript-api/k6-browser/page/waitforfunction.md
Outdated
Show resolved
Hide resolved
docs/sources/v0.53.x/javascript-api/k6-browser/page/waitforfunction.md
Outdated
Show resolved
Hide resolved
docs/sources/next/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md
Outdated
Show resolved
Hide resolved
docs/sources/v0.52.x/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md
Outdated
Show resolved
Hide resolved
docs/sources/v0.53.x/using-k6-browser/recommended-practices/hybrid-approach-to-performance.md
Outdated
Show resolved
Hide resolved
docs/sources/next/using-k6-browser/recommended-practices/simulate-user-input-delay.md
Outdated
Show resolved
Hide resolved
docs/sources/next/using-k6-browser/recommended-practices/simulate-user-input-delay.md
Outdated
Show resolved
Hide resolved
docs/sources/next/using-k6-browser/recommended-practices/simulate-user-input-delay.md
Outdated
Show resolved
Hide resolved
docs/sources/next/using-k6-browser/recommended-practices/simulate-user-input-delay.md
Show resolved
Hide resolved
@ankur22 Thanks for your review! I've made the updates 👍 |
What?
We're replacing sync
check
of k6 with the asynccheck
utility function.Along the way, I've also fixed some small issues I saw.
Why
Writing concise code can be difficult when using the k6
check
function with async code since it doesn't support async APIs. A solution that we have suggested so far is to declare a temporary variable, wait for the value that is to be checked, and then check the result later. However, this approach can clutter the code with single-use declarations and unnecessary variable names, for example:To address this limitation, we've added a version of the
check
function to jslib.k6.io that makes working withasync
/await
simpler. Thecheck
function is a drop-in replacement for the built-in check, with added support for async code. AnyPromise
s will be awaited, and the result is reported once the operation has been completed:Related PR(s)/Issue(s)
Closes #1725
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.