Skip to content

Commit

Permalink
doc: add missing function to test common doc
Browse files Browse the repository at this point in the history
Add documentation for `common.expectsError()` to `test/README.md`.

PR-URL: nodejs#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]>
  • Loading branch information
Trott authored and italoacasas committed Feb 20, 2017
1 parent 795e0dd commit 1bc4301
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,22 @@ Platform normalizes the `dd` command

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

### expectsError(code[, type[, message]])
* `code` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
expected error must have this value for its `code` property
* `type` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)
expected error must be an instance of `type`
* `message` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
or [&lt;RegExp>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)
if a string is provided for `message`, expected error must have it for its
`message` property; if a regular expression is provided for `message`, the
regular expression must match the `message` property of the expected error

* return function suitable for use as a validation function passed as the second
argument to `assert.throws()`

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).

### expectWarning(name, expected)
* `name` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
* `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)
Expand Down

0 comments on commit 1bc4301

Please sign in to comment.