cypress-io / sinon-chai

Extends Chai with assertions for the Sinon.JS mocking framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve expect(stub).secondCall.calledWith(...) error message when called once

kuceb opened this issue · comments

commented

Current, if the stub was only called once, and you try to chain something off .secondCall, you get a terrible error message:

// stub was only called once
expect(stub).secondCall.calledWith(...)

TypeError: Cannot read property 'calledWith' of undefined

Desired Error message:

"Error: expected stub to be calledTwice, but it was only called once"

This also goes for firstCall, thirdCall, and getCall(n)

Tasks

  • check if this is fixed already in upstream repo