Skip to content
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

t.throws doesn't recognize falsy thrown values #3312

Closed
gibson042 opened this issue Feb 27, 2024 · 0 comments · Fixed by #3313
Closed

t.throws doesn't recognize falsy thrown values #3312

gibson042 opened this issue Feb 27, 2024 · 0 comments · Fixed by #3313

Comments

@gibson042
Copy link
Contributor

t.throws documents that an expectation with property "any" set to true should result in a passing assertion when the function throws a non-error value, which doesn't work when the thrown value is falsy.

Concretely, the following test should pass:

test("throws(throwsFalse)", t => {
  t.throws(() => { throw false; }, { any: true });
});

but instead fails against ava version 6.1.1:

   2: test("throws(throwsFalse)", t => {                      
   3:   t.throws(() => { throw false; }, { any: true });
   4: });                                               

  Function returned:

  undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant