From 8d10e2c31b4d94948b9f7f43e047a9964055c58c Mon Sep 17 00:00:00 2001 From: MURAKAMI Masahiko Date: Fri, 2 Dec 2022 15:34:53 +0900 Subject: [PATCH] test_runner: add resetCalls to MockFunctionContext This commit allows tests in test runner to reset the calls of mock function Refs: https://github.com/nodejs/node/pull/45326#discussion_r1014728750 --- doc/api/test.md | 8 ++++++++ lib/internal/test_runner/mock.js | 4 ++++ test/parallel/test-runner-mocking.js | 17 +++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/doc/api/test.md b/doc/api/test.md index 3588c6d6acd45b..3344ea9b53332c 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -870,6 +870,14 @@ test('changes a mock behavior once', (t) => { }); ``` +### `ctx.resetCalls()` + + + +Reset the calls of mock function. + ### `ctx.restore()`