Use `throw` instead of `$.error` and use `#toThrow` matcher.