-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Issue #5197: Add descriptive error to Expect CalledWith methods when missing optional arguments #5547
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5547 +/- ##
=======================================
Coverage 61.67% 61.67%
=======================================
Files 213 213
Lines 7160 7160
Branches 4 4
=======================================
Hits 4416 4416
Misses 2743 2743
Partials 1 1 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test showing that the error message is correct?
Nice! Could you update the changelog as well? 🙂 |
Yep, thanks for reviewing @SimenB! Do we update the changelog for every change or is there a minimum bar? |
My rule of thumb is every change that changes some behaviour should get an entry |
Can you rebase? The diff in this PR is hard to read with all the extra commits |
…unexpected argument
…apshot update upcoming)
8dfe8dc
to
b5118f0
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Issue: #5197
Specifically, formatMismatchedArgs will not add an error message when the received array gets extra argument(s) w/ undefined value since expected[i] and received[i] will both equal undefined (where received[i] is explicitly set to undefined whereas expected[i] is not in the array)
Test plan
Tested using @mrfunkycold repo: https://github.com/mrfunkycold/jest-demo. New error message:
● testFile › 1. when invoked › 1. fails to print the error line
expect(jest.fn()).toHaveBeenCalledWith(expected)