diff options
Diffstat (limited to 'test/README.md')
-rw-r--r-- | test/README.md | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/README.md b/test/README.md index ae54942062..b6b21ef772 100644 --- a/test/README.md +++ b/test/README.md @@ -324,7 +324,7 @@ Gets IP of localhost Array of IPV6 hosts. -### mustCall(fn[, expected]) +### mustCall([fn][, expected]) * fn [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) * expected [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1 * return [<Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) @@ -333,6 +333,8 @@ Returns a function that calls `fn`. If the returned function has not been called exactly `expected` number of times when the test is complete, then the test will fail. +If `fn` is not provided, `common.noop` will be used. + ### nodeProcessAborted(exitCode, signal) * `exitCode` [<Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) * `signal` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) @@ -340,6 +342,18 @@ fail. Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise. +### noop + +A non-op `Function` that can be used for a variety of scenarios. + +For instance, + +```js +const common = require('../common'); + +someAsyncAPI('foo', common.mustCall(common.noop)); +``` + ### opensslCli * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |