This fails:
t.throws(() => { throw new TypeError("Invalid URL: http://") }, /^Invalid URL/)
... yet:
/^Invalid URL/.test("Invalid URL: http://")
//-> true
error can be an error constructor, error message, regex matched against the error message, or validation function.