Conversation
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66476 +/- ##
==========================================
- Coverage 92.74% 90.40% -2.35%
==========================================
Files 422 791 +369
Lines 193170 276097 +82927
Branches 29783 52986 +23203
==========================================
+ Hits 179160 249605 +70445
- Misses 13682 16905 +3223
- Partials 328 9587 +9259
🚀 New features to boost your workflow:
|
atlowChemi
reviewed
Oct 4, 2026
araujogui
force-pushed
the
test-runner-mock-call-assertions
branch
2 times, most recently
from
October 4, 2026 21:02
62f7866 to
32a98df
Compare
Add t.assert.called(), t.assert.callCount(), t.assert.nthCalledWith() and t.assert.lastCalledWith() for asserting on mock function calls. Assisted-by: Claude Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
araujogui
force-pushed
the
test-runner-mock-call-assertions
branch
from
October 5, 2026 14:40
32a98df to
be90007
Compare
atlowChemi
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds four assertions to
t.assertfor checking mock function calls:t.assert.called(fn[, message])t.assert.callCount(fn, times[, message])t.assert.nthCalledWith(fn, n, ...args)t.assert.lastCalledWith(fn, ...args)This is syntactic sugar. Everything here can already be written with
fn.mock.callCount(),fn.mock.callsandassert.deepStrictEqual(). It is also possible today in userland withassert.register(). The goal is to make the most common mock checks shorter. Like the othert.assertmethods, these count towardt.plan().nthCalledWith(1-based, like Jest/Vitest) andlastCalledWithcheck a single call, so their failures show a regulardeepStrictEqualdiff.Examples from nodejs/doc-kit
logger.test.mjstransports/github.test.mjs