Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Fix throws TypeError when passing an arrow function #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wmzy
Copy link

@wmzy wmzy commented Sep 30, 2019

Codes like this:

    should.throws(
      () => {
        throw new Error();
      },
      () => true
    );

won't work:

TypeError: Function has non-object prototype 'undefined' in instanceof check

@btd
Copy link
Member

btd commented Oct 5, 2019

should.throws follow assert.throws behavior only. Your use case is not supported by assert.throws as i see.

@wmzy
Copy link
Author

wmzy commented Oct 8, 2019

assert.throws support this.
See the "Custom error validation" example.

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

Successfully merging this pull request may close these issues.

2 participants