@@ -397,7 +397,7 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
397397 const callCount = spy . mock . calls . length
398398 return this . assert (
399399 callCount === number ,
400- `expected "${ spyName } " to be called #{exp} times` ,
400+ `expected "${ spyName } " to be called #{exp} times, but got ${ callCount } times ` ,
401401 `expected "${ spyName } " to not be called #{exp} times` ,
402402 number ,
403403 callCount ,
@@ -410,7 +410,7 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
410410 const callCount = spy . mock . calls . length
411411 return this . assert (
412412 callCount === 1 ,
413- `expected "${ spyName } " to be called once` ,
413+ `expected "${ spyName } " to be called once, but got ${ callCount } times ` ,
414414 `expected "${ spyName } " to not be called once` ,
415415 1 ,
416416 callCount ,
@@ -420,14 +420,15 @@ export const JestChaiExpect: ChaiPlugin = (chai, utils) => {
420420 def ( [ 'toHaveBeenCalled' , 'toBeCalled' ] , function ( ) {
421421 const spy = getSpy ( this )
422422 const spyName = spy . getMockName ( )
423- const called = spy . mock . calls . length > 0
423+ const callCount = spy . mock . calls . length
424+ const called = callCount > 0
424425 const isNot = utils . flag ( this , 'negate' ) as boolean
425426 let msg = utils . getMessage (
426427 this ,
427428 [
428429 called ,
429430 `expected "${ spyName } " to be called at least once` ,
430- `expected "${ spyName } " to not be called at all` ,
431+ `expected "${ spyName } " to not be called at all, but actually been called ${ callCount } times ` ,
431432 true ,
432433 called ,
433434 ] ,
0 commit comments