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

Should.be.rejected.with(Error) compares for same error object, not equal #120

Closed
philosoralphter opened this issue Aug 17, 2015 · 2 comments

Comments

@philosoralphter
Copy link

This shouldn't happen:

Unhandled rejection AssertionError: expected promise to be rejected with [Error: Could not find route to handle path: /test/wrong/path] but it was rejected with [Error: Could not find route to handle path: /test/wrong/path]

If this assertion is checking that the error object created in the code is the exact same object as the one I create in the test, then it will never be of use. They are different objects that need to be compared for properties, etc., not identity.

I'm sure this works with string rejection reasons, but It should also work with error objects because those are more useful.

@domenic
Copy link
Collaborator

domenic commented Aug 17, 2015

It is intended to work the same as Chai's assert.throws. It mismatches in some edge cases; see #47. But I believe this is the same behavior as Chai, and so we're not going to change it in the way you describe.

@philosoralphter
Copy link
Author

Thanks @domenic . I should have looked into it further.

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