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] Jest 16 breaks using toHaveBeenCalledWith
with 0 arguments to test for functions that have been called without arguments
#1899
Comments
Ok, have been diving in a bit. The matcher itself (defined in I'm not clear yet on where that argument passing is happening, but will try to figure it out and open a PR if I can Update: I think I'll need some help to track this down. Enough changed with these matchers during this last release that I can't trace down where this broke. |
toHaveBeenCalledWith
with 0 arguments to test for functions that have been called without argumentstoHaveBeenCalledWith
with 0 arguments to test for functions that have been called without arguments
Just out of curiosity: why don't you use |
'toHaveBeenCalled' checks that the function was called at all. I have a test that specifically tests a function was called with no arguments. The real world use case: This function acts on a list, and either takes an id (and acts on a single item) or is called without an id (and acts on the whole list) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
On Jest 16: testing
toHaveBeenCalledWith
with 0 arguments does not pass when a spy is called with 0 argumentsOn Jest 15: testing
toHaveBeenCalledWith
with 0 arguments passes when a spy is called with 0 argumentsIf the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can
npm install
andnpm test
.Minimal test:
Repo: https://github.com/benmccormick/jest-no-args/tree/master
What is the expected behavior?
Testing using
toHaveBeenCalledWith
with 0 arguments should pass an assertion when a spy is called with 0 argumentsRun Jest again with
--debug
and provide the full configuration it prints. Please mention your node and npm version and operating system.Node Version: 6.7.0
NPM Version: 3.10.7
The text was updated successfully, but these errors were encountered: