You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it("Should throw an error",async()=>{returnexpect(Promise.reject()).to.be.rejectedWith("Error");});
Instead of giving details about what went wrong (explaining that it expected the error to be "Error" but instead got undefined), it gives a very un-detailed internal error message as shown below:
TypeError: Cannot read property 'message' of undefined
at Object.compatibleMessage (node_modules/check-error/index.js:78:71)
at getBasePromise.then.reason (node_modules/chai-as-promised/lib/chai-as-promised.js:191:77)
The text was updated successfully, but these errors were encountered:
When a promise is rejected, we currently incorrectly assume the
rejection reason is an object consumable by check-error (i.e. an `Error`
or similar).
This change basically checks strict equality on the matcher and the
thrown error first (such that `rejectedWith(undefined)` would work). It
then falls back to the original logic only if both the matcher and the
reason are truthy.
Fixes#263
When a promise is rejected, we currently incorrectly assume the
rejection reason is an object consumable by check-error (i.e. an `Error`
or similar).
This change basically checks strict equality on the matcher and the
thrown error first (such that `rejectedWith(undefined)` would work). It
then falls back to the original logic only if both the matcher and the
reason are truthy.
Fixes#263
The following test doesn't work.
Instead of giving details about what went wrong (explaining that it expected the error to be "Error" but instead got undefined), it gives a very un-detailed internal error message as shown below:
The text was updated successfully, but these errors were encountered: