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 is not matching errors properly by Prototype #1493

Closed
maxcnunes opened this issue Aug 23, 2017 · 1 comment
Closed

t.throws is not matching errors properly by Prototype #1493

maxcnunes opened this issue Aug 23, 2017 · 1 comment

Comments

@maxcnunes
Copy link

Description

For few custom errors the t.throws weren't detecting the error type I passed to t.throws to assert with. The problem occurs because core-assert isn't giving the right match response on checking the error type based in the prototype. I have fixed that locally and now my tests are passing. Please accept my PR sindresorhus/core-assert#2 and bump it up on ava dependencies.

Test Source

  t.throws(
    () => deleteItem(initialState, operation),
    NotFoundObject
  );

Error Message & Stack Trace

bildschirmfoto 2017-08-23 um 10 52 28

Environment

Node.js v7.10.0
darwin 16.6.0
ava 0.22.0
npm 4.2.0

@novemberborn
Copy link
Member

novemberborn commented Aug 27, 2017

I'm not sure whether sindresorhus/core-assert#2 can be landed: sindresorhus/core-assert#2 (comment)

The plan is to refactor t.throws() to move away from core-assert: #1047 (comment)

Regardless, we'll enforce that constructors are extending Error. Is that the case with NotFoundObject? Going by AVA's error output it looks like it's a standalone class. That might also be why your test is currently failing.

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

No branches or pull requests

2 participants