The alternative would be to fix the implementation of throws to match the types. This would be preferable, in my view — I want to compare an error message against an expected string far more often than I want to convert it to a regex. Right now, if you include a string (or, in uvu's eyes, don't include an expected value) then all it's doing is checking that some error was thrown, which feels a bit too loosey-goosey.
The alternative would be to fix the implementation of
throws
to match the types. This would be preferable, in my view — I want to compare an error message against an expected string far more often than I want to convert it to a regex. Right now, if you include a string (or, in uvu's eyes, don't include anexpected
value) then all it's doing is checking that some error was thrown, which feels a bit too loosey-goosey.