-
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
throws doesn't count against assertion count and doesn't require error param #309
Comments
How does t.throws(() => signupDB(...)); Does it return a promise that gets rejected? In that case, do not wrap it in a function, but do return the result of test(t=> {
return t.throws(signupDB(...));
}); |
Ahhh, it was the |
If I recall correctly, you must supply a string for an === comparison. I think I noticed that in the source a few days ago and meant to add regexp matching to my todos. Thanks for the reminder. |
That works for me, thanks! |
Nope, I read the source wrong on that. Should support the same values for |
Ah, that explains it then, from |
So what's the resolution on this? Anything we can do with the docs to make the behavior clearer? |
Thanks for following up on this! In the With regards to the assertion, I'd say for now just add in that |
@sindresorhus: If you don't mind, I'm going to give this a go. I've been discussing this with @jamestalmage, and here's what I think I need to do (I've started on this a little):
If anyone has any other ideas for things to test, or other feedback, that would be awesome! |
Just to clarify, there is a bit of a new idea here. That is to track the promises passed to |
Ok, This is fixed in #360. |
Here's my actual code:
As is, it fails unless the first line is
t.plan(0)
(Assertion count does not match planned). I would assume athrows
would count as an assertion, right?Second, the docs show
error
is the second required param, but the assertion is successful no matter what value I put in there. I can even leave it undefined (as above) & it still passes.As a workaround, I'm using a try catch block that works fine, but it'd be nice to condense the code & just use throws.
The text was updated successfully, but these errors were encountered: