should.js
should.js copied to clipboard
Fix throws `TypeError` when passing an arrow function
Codes like this:
should.throws(
() => {
throw new Error();
},
() => true
);
won't work:
TypeError: Function has non-object prototype 'undefined' in instanceof check
should.throws follow assert.throws behavior only. Your use case is not supported by assert.throws as i see.
assert.throws support this.
See the "Custom error validation" example.