-
Notifications
You must be signed in to change notification settings - Fork 112
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
Proxying makes use order matter with chai-exclude and chai-as-promised #266
Comments
I figured out my actual issue. Both extensions do proxying on equal/equals. If chaiAsPromised isn't last, the proxy from chaiExclude drops information about the subject being a promise. Runkit at https://runkit.com/kwasimensah/5efdfbea19e9950013f020e0
More specifically, chai-excludes's assertEqual returns undefined, which means overwritingMethodWrapper creates newAssertion which drops the then attribute that transferPromisness added to the current assertion. |
I filed the the Typescript side of this at microsoft/TypeScript#39387.
"expect.eventually" returns a Chai.PromisedAssertion which doesn't warn when using await. Which means "await expect(myPromise).eventually.to.equal(arg)" will throw UnhandledPromiseRejectionWarning if the assertion is wrong but the test will still succeed.
if expect.eventually actually returns a promise it should be safe to use with await.
The text was updated successfully, but these errors were encountered: