Fail function does not pass validation in web scripting interface

#1

The example in k6 docs will not pass validation when editing a script in the web script editor.

check(res, {
    "status code MUST be 200": (res) => res.status == 200,
  }) || fail("status code was *not* 200");

13%20PM

https://docs.k6.io/docs/fail-err

#2

Thanks for notifying us of this issue! I’m a bit hesitant what the right approach is here - we can relax the linter, but to be honest, I’m not sure that the suggested check() || fail() approach is the best way to write JS code… And it’s not all that shorter than something more idiomatic like:

if (!check(thingToCheck, someChecks)) {
  fail("blah") // or throw new Error("blah")
}