-
-
Notifications
You must be signed in to change notification settings - Fork 697
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
chai-as-promised broken by change to addMethod and addProperty #723
Comments
Hmm, since I sent that PR I will make sure to take a look at it too next week (probably this weekend, but I cannot guarantee). |
This problem can be resolved from within chai by adding chai-as-promised's var newAssertion = new chai.Assertion();
transferFlags(this, newAssertion);
if ("then" in this) newAssertion.then = this.then.bind(this); // Resolves the problem
return newAssertion; But I haven't found a way to resolve it from within chai-as-promised. Edit: Opened PR with possible solution |
@meeber I think it would be better to solve this in Great work tracking this down, I hadn't had enough time to check this on the weekend, college's last weeks are driving me crazy, however I took some time today to investigate this and left a comment at your PR on Anyway, good job! |
I'm not sure we should be making changes in Chai as Promised to compensate for Chai breaking backward compatibility in a non-major version. |
@domenic I agree with your sentiment - I wonder what the most pragmatic thing to do here is though? We're right around the corner from |
As an aside to spike a bit of discussion - I think we should look at somehow pulling in a handful of plugins as part of chai's test suite, to stop or at least notify us of changes to Chai that break plugin compat. |
@keithamus Great idea, I'd love to have that. I also have a doubt: although that PR was merged on master it will just be out in the wild when we release |
Yeah you're right actually. I was confused and thought #642 was part of |
So just to reiterate to @domenic - this change will actually be part of a breaking change in |
OK, great! Happy to accept fixes to Chai as Promised once Chai 4.0 is released, but it's good to know no existing users who respect the peer dependency warnings will be broken. |
Yup, just wanted to make sure we had this ironed out prior to 4.0 release, sorry for the confusion. We have a WIP PR going on at chaijs/chai-as-promised#157 for discussion. |
Closing this in favor of chaijs/chai-as-promised#157 |
@keithamus @lucasfcosta @domenic
A PR submitted back in March (#642) seems to break chai-as-promised. The PR changed
addMethod
andaddProperty
so that it returns a new assertion with flags transferred over instead of returningthis
. However, it seems that chai-as-promised relies on the previous behavior so as not to lose the promise throughout the chain.I haven't yet dived in deeply enough to know if this is in an easy fix (for chai or for chai-as-promised). Just raising awareness.
The text was updated successfully, but these errors were encountered: