Skip to content

Commit ef1731d

Browse files
Trottitaloacasas
authored andcommitted
doc: add missing function to test common doc
Add documentation for `common.expectsError()` to `test/README.md`. PR-URL: #11382 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 5723087 commit ef1731d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,22 @@ Platform normalizes the `dd` command
180180

181181
Check if there is more than 1gb of total memory.
182182

183+
### expectsError(code[, type[, message]])
184+
* `code` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
185+
expected error must have this value for its `code` property
186+
* `type` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
187+
expected error must be an instance of `type`
188+
* `message` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
189+
or [&lt;RegExp>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)
190+
if a string is provided for `message`, expected error must have it for its
191+
`message` property; if a regular expression is provided for `message`, the
192+
regular expression must match the `message` property of the expected error
193+
194+
* return function suitable for use as a validation function passed as the second
195+
argument to `assert.throws()`
196+
197+
The expected error should be [subclassed by the `internal/errors` module](https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md#api).
198+
183199
### expectWarning(name, expected)
184200
* `name` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
185201
* `expected` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [&lt;Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)

0 commit comments

Comments
 (0)