Can I use a separate function to perform a check?

FWIW: I used to fail the step a different way - using an example from your original documentation, which led to this ticket: Fail function does not pass validation in web scripting interface

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