-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support message testing function in throws
& throwsAsync
assertions
#2995
Conversation
You also need to update the TypeScript types. |
The commit includes changes in docs, `instaceOf Function` and TS types.
@il3ven the code looks great, but it seems some tests are not passing. |
@novemberborn I have fixed the test in Steps to reproduce
Error output in my system
My Machine |
Yea I think that test is flaky, no worries. |
@il3ven sorry I was AFK for nearly two weeks :) Test pass now, but it strikes me there's no test for the new behavior? |
No problem.
I will add them. Can you provide the files where these tests should be added? Or maybe point me to existing tests for the throwsAsync function. |
IIRC it's all in https://github.com/il3ven/ava/blob/throws/test-tap/assert.js#L915=. |
@novemberborn I have added test cases to cover the code that I added. I have also added a few more cases to cover similar code which was uncovered before. I haven't added a test case for |
@il3ven this is great! The additional test cases would be nice to communicate intent, but then again it's a massive test file that we haven't ported to be self-hosted, so I'm not too concerned about that. |
throws
/throwsAsync
assertionthrows
& throwsAsync
assertions
Fixes #2978
As per the issue #2978, I have added support for function in
throws
/throwsAsync
assertion. I have also updated the docs regarding the same. I couldn't find any tests to be updated so I have left them.How to use?
Note: This is my first PR in ava so I may have missed something. Please let me know. I will fix it. For example, I am not sure about the assertion message to show in case of failure.