-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow assert.rejects to take only one argument #219
Comments
Yes, I agree that the second argument should be optional, as stated in the docs. This is a bug. Would you care to send a PR with a fix? |
Regarding matchers, I think you can already pass something like |
I'd love to do a PR, but my company requires me to get legal approval, etc., which would take a while. Regarding the matcher, I can't seem to get it to work. Do you have an example? |
This should work: const { assert, match } = require('@sinonjs/referee');
await assert.rejects(Promise.reject('nope'), match.string); |
The
assert.rejects
function currently requires a second argument, which much beidentical
to what the target function rejected with. This can be difficult to determine in many cases. It would be great if the second argument was optional (for what it's worth, the docs say the second param is optional here, but maybe these aren't up to date: https://sinonjs.github.io/referee/#rejects). Here's an example (using mocha) of how I'd like this to work:Or perhaps it could follow the same api as
assert.match()
. Then I could do something like:The text was updated successfully, but these errors were encountered: