Skip to content

assert: support arrow functions in .throws()

Rodrigo Muino Tomonari requested to merge github/fork/bnoordhuis/bug3275 into master

x instanceof f where f is an arrow function throws a (spec-conforming) "Function has non-object prototype 'undefined' in instanceof check" exception.

Add a workaround so that it's possible to pass arrow functions as the second argument to assert.throws(). The try/catch block is a little jarring but swapping around the clauses in the if statements changes the semantics too much.

Fixes: https://github.com/nodejs/node/issues/3275

R=@thefourtheye

CI: https://ci.nodejs.org/job/node-test-pull-request/453/

Merge request reports

Loading