-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Why does code
need to be a string in the expected
parm of t.throws
?
#1901
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
Comments
This was modeled after the But happy to support numbers as well. |
Hello @novemberborn Can I work on this? |
@okyantoro let's see if @ronen was keen on tackling this soon, given that he raised the issue. Appreciate the enthusiasm though 👍 |
Sure @novemberborn :) |
@okyantoro go for it! (I'm happy to complain but not actually fix anything myself :) |
All yours @okyantoro! |
Thank you @novemberborn @ronen I created a pull request in #1902. Let me know if I do something wrong with the unit test. Thank you |
Description
t.throws()
andt.throwsAsync()
take an optionalexpected
argument, which is documented asBut the documentation doesn't mention that it requires expected
.code
value to be a string (https://github.com/avajs/ava/blob/master/lib/assert.js#L109).In my app,
.code
is an integer. Is there a reason not to allow a matcher for integers? If so it'd be nice to mention that requirement in the doc. If not, it'd be nice to change it :)(I tried passing the code as a string, in case it'd test with
==
but no luck :)Of course simple workaround is to use
err = async t.throwsAsync(...); t.is(err.code, 12345)
Thanks
Environment
The text was updated successfully, but these errors were encountered: