summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-02-14 11:00:34 -0800
committerJames M Snell <jasnell@gmail.com>2017-02-16 12:46:14 -0800
commitb5c8852ab5f44c0bc0e8ead6c3ad4c9fc25daee1 (patch)
treeb8708a42f8b285d3598829bb15625a391bce4dff /test
parent08f15d85d3f970eed13924caffb2d69751ebf9e3 (diff)
downloadandroid-node-v8-b5c8852ab5f44c0bc0e8ead6c3ad4c9fc25daee1.tar.gz
android-node-v8-b5c8852ab5f44c0bc0e8ead6c3ad4c9fc25daee1.tar.bz2
android-node-v8-b5c8852ab5f44c0bc0e8ead6c3ad4c9fc25daee1.zip
doc: add missing function to test common doc
Add documentation for `common.expectsError()` to `test/README.md`. PR-URL: https://github.com/nodejs/node/pull/11382 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/README.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/README.md b/test/README.md
index 5ed028a196..8affd257a7 100644
--- a/test/README.md
+++ b/test/README.md
@@ -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)