Skip to content

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

Closed
@gibson042

Description

@gibson042

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions