You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for creating this issue! We've considered something like this before, though mostly intended for non-syntax script errors (e.g. trying to use the body of a response for a failed request without checking it), see #877. From what I understand, you'd like k6 to exit on the first such script error it sees, right?
As a workaround right now, you can add a custom Counter metric, surround your code with a try {} catch() {} block and increment the counter in the catch. Then, if you have a threshold on the new metric with abortOnFail, k6 will abort the test script after you increment the counter. Though not immediately, k6 evaluates thresholds every 2 seconds.
Soon, when we merge #2093 (either in the upcoming k6 v0.35.0 or v0.36.0), we'll have a way to immediately abort the whole script, so there won't be a need for the threshold (you'd still need the try/catch block though)...
Feature Description
If I write something like the following and run it:
export default function() { hurz }
k6 will write an error to the console like the following:
ERRO[0000] ReferenceError: hurz is not defined
But will exit normally and print out the usual statistics.
I couldn't find a way to tell k6 to exit abnormally if it encounters an error like this. Is there a way to tell k6 to do this?
Suggested Solution (optional)
Add a configuration option to make k6 exit non-zero if it encounters Javascript errors during execution.
The text was updated successfully, but these errors were encountered: