chaijs / chai-spies

Spies for Chai Assertion Library.
MIT License
132 stars 29 forks source link

Feature: called with reports actual arguments #116

Open alex-Symbroson opened 2 years ago

alex-Symbroson commented 2 years ago

Please include a report to get the called.with assertions which shows which arguments were actually called.

This is a suggestion I came up with: in spy.js, for any called.with assertion, add the argument spy.calls.find(args => !_.eql(args, expArgs)) not sure if its possible to react to negations - that would be the only problem

      this.assert(
          passed > 0
        , 'expected ' + this._obj + ' to have been called with #{exp}'
        , 'expected ' + this._obj + ' to have not been called with #{exp} but got ' + passed + ' times'
        , expArgs
        , spy.calls.find(args => !_.eql(args, expArgs))
      );

thanks and best regards