chai-as-promised broken by change to addMethod and addProperty
See original GitHub issue@keithamus @lucasfcosta @domenic
A PR submitted back in March (https://github.com/chaijs/chai/pull/642) seems to break chai-as-promised. The PR changed addMethod
and addProperty
so that it returns a new assertion with flags transferred over instead of returning this
. 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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
4.x.x Complete Migration Guide #781 - chaijs/chai - GitHub
This change causes the assertion to pass instead. ... chai-as-promised broken by change to addMethod and addProperty #723, PRs: addMethod ...
Read more >Diff - infra/third_party/npm_modules - Google Git
-These changes have been implemented in a non-breaking way, but a depretiation -warning will be presented to users until they migrate.
Read more >Chai Assertions for Promises
Chai as Promised extends Chai with a fluent language for asserting facts about ... To change this behavior, for instance to output a...
Read more >chakram - UNPKG
node_modules/chai-as-promised/lib/chai-as-promised.js", ... This is no longer recommended, instead use either addMethod, addProperty or addRawPlugin.
Read more >2702747-2.patch - Drupal
Instead +of using `addProperty` to register terminating assertions, ... + +These changes have been implemented in a non-breaking way, but a depretiation ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
This problem can be resolved from within chai by adding chai-as-promised’s
transferPromiseness
logic before thereturn newAssertion
in addMethod and addProperty:But I haven’t found a way to resolve it from within chai-as-promised.
Edit: Opened PR with possible solution