Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: toHaveBeenCalledExactlyOnceWith only reports first argument of method call in feedback on a failed assertion. #690

Open
GRollason opened this issue Jun 11, 2024 · 1 comment

Comments

@GRollason
Copy link

Bug

  • package version: 4.0.2
  • node version: 20.12.0
  • npm (or yarn) version: 10.5.0

Relevant code or config

Test code: expect(methodName).toHaveBeenCalledExactlyOnceWith(1stArgument)
Implementation code: methodName(1stArgument, 2ndArgument)

What you did:
Asserted 'toHaveBeenCalledExactlyOnceWith' with an incorrect number of arguments.

What happened (please provide anything you think will help):
The error message states:
'Expected mock function to have been called exactly once with [1stArgument], but it was called with [1stArgument]'
The output should presumably be 'Expected mock function to have been called exactly once with [1stArgument], but it was called with [1stArgument, 2ndArgument]'.

First argument in question was an object, the second was a primitive Boolean. This is obviously quite painful as the output from the failed assertion looks to be correct, despite the reported error.

Reproduction repository (if possible):
N/A

@tgfisher4
Copy link

Will be fixed by #675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants