Commit Graph

5 Commits

Author SHA1 Message Date
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2023-02-14 18:45:16 +01:00
Erick Wendel
929aada39d
test: fix mock.method to support class instances
It fixes a problem when trying to spy a method
from a class instance or static functions
on a class instance

PR-URL: https://github.com/nodejs/node/pull/45608
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-12-17 14:35:09 +00:00
MURAKAMI Masahiko
01b7ac6051
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
PR-URL: https://github.com/nodejs/node/pull/45710
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2022-12-08 20:28:38 +00:00
MURAKAMI Masahiko
afed1afa55 test_runner: add getter and setter to MockTracker
This commit allows tests in test runner to use the
`getter` and `setter` methods as "syntax sugar" for
`MockTracker.method` with the `options.getter` or
`options.setter` set to true in the options.

Refs: https://github.com/nodejs/node/pull/45326#discussion_r1014727289
PR-URL: https://github.com/nodejs/node/pull/45506
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-11-27 23:12:13 +00:00
cjihrig
7c6682957b
test_runner: support function mocking
This commit allows tests in the test runner to mock functions
and methods.

PR-URL: https://github.com/nodejs/node/pull/45326
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-11-07 18:25:54 -05:00