You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using nthCalledWith, but expecting no arguments, the code does not read intuitively for those who are not familiar with this Jest matcher. I think the wording should be updated, or better still the ability to chain the command.
Motivation
Generally, Jest code is very declarative and can be read by those with no understanding of the framework. It could even be easily understood by those with little technical skill. This matcher, called in this circumstance is harder to understand.
Example
No response
Pitch
> foo.js
...
bar();
bar("foo");
....
Current method:
...
expect(bar).nthCalledWith(1); //novice PR reviewer: "but bar isn't called with 1"
expect(bar).nthCalledWith(2, "foo"); //this context makes it obvious
...
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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🚀 Feature Proposal
When using
nthCalledWith
, but expecting no arguments, the code does not read intuitively for those who are not familiar with this Jest matcher. I think the wording should be updated, or better still the ability to chain the command.Motivation
Generally, Jest code is very declarative and can be read by those with no understanding of the framework. It could even be easily understood by those with little technical skill. This matcher, called in this circumstance is harder to understand.
Example
No response
Pitch
Current method:
Proposed change:
I have tried to make the wording read similar to
.toBeCalledWith
,.toBe
etcEDIT +1hr
On second thoughts, perhaps
expect(bar).nthCalledWith(1, expect.nothing)
would work too.The text was updated successfully, but these errors were encountered: