Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix wrong messages for nthCalledWith
  • Loading branch information
chinesedfan committed May 29, 2018
commit 1688d706b9df36ff63fbdff56aab71b6ed63008e
6 changes: 5 additions & 1 deletion packages/expect/src/spy_matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ const createNthCalledWithMatcher = (matcherName: string) => (
`Expected ${identifier} ${nthToString(
nth,
)} call to have been called with:\n` +
formatMismatchedCalls(calls, expected, LAST_CALL_PRINT_LIMIT);
formatMismatchedCalls(
calls[nth - 1] ? [calls[nth - 1]] : [],
expected,
LAST_CALL_PRINT_LIMIT,
);

return {message, pass};
};
Expand Down