Commit ded4f91e authored by Ben Noordhuis's avatar Ben Noordhuis
Browse files

assert: support arrow functions in .throws()

`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
PR-URL: https://github.com/nodejs/node/pull/3276


Reviewed-By: default avatarMichaël Zasso <mic.besace@gmail.com>
Reviewed-By: default avatarSakthipriyan Vairamani <thechargingvolcano@gmail.com>
parent ccaaae9d
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment