chaijs / chai-as-promised

Extends Chai with assertions about promises.
MIT License
1.42k stars 109 forks source link

Overloading `rejectedWith` to handle `undefined` input #279

Open mheine opened 1 year ago

mheine commented 1 year ago

This is more of a general question, and may be more related to chai itself rather than chai-is-promised - apologies if this is the wrong forum.

The rejectedWith function is working as intended according to the documentation; however I stumbled over #123 when I (accidentally) passed undefined as a parameter. I would like to raise some sort of warning when this happens - and I'm not requesting that we change the actual implementation, but I was wondering:

Is there a (simple) way to overload a chai-as-promised method?

As far as I could tell the only realistic way would be to re-write the entire function and then call chai.use(function (_chai, utils) { ... } - is there another way that I am missing?

Cheers, and thank you so much for the work that you've put in!