summaryrefslogtreecommitdiff
path: root/test/common/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'test/common/README.md')
-rw-r--r--test/common/README.md43
1 files changed, 28 insertions, 15 deletions
diff --git a/test/common/README.md b/test/common/README.md
index 44e9c4e8cd..32ca671157 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -51,28 +51,41 @@ Platform normalizes the `dd` command
Check if there is more than 1gb of total memory.
### expectsError([fn, ]settings[, exact])
-* `fn` [<Function>]
+* `fn` [<Function>] a function that should throw.
* `settings` [<Object>]
- with the following optional properties:
+ that must contain the `code` property plus any of the other following
+ properties (some properties only apply for `AssertionError`):
* `code` [<String>]
- expected error must have this value for its `code` property
+ expected error must have this value for its `code` property.
* `type` [<Function>]
- expected error must be an instance of `type`
- * `message` [<String>]
- or [<RegExp>]
+ expected error must be an instance of `type` and must be an Error subclass.
+ * `message` [<String>] or [<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
+ regular expression must match the `message` property of the expected error.
+ * `name` [<String>]
+ expected error must have this value for its `name` property.
+ * `generatedMessage` [<String>]
+ (`AssertionError` only) expected error must have this value for its
+ `generatedMessage` property.
+ * `actual` <any>
+ (`AssertionError` only) expected error must have this value for its
+ `actual` property.
+ * `expected` <any>
+ (`AssertionError` only) expected error must have this value for its
+ `expected` property.
+ * `operator` <any>
+ (`AssertionError` only) expected error must have this value for its
+ `operator` property.
* `exact` [<Number>] default = 1
+* return [<Function>]
-* return function suitable for use as a validation function passed as the second
- argument to e.g. `assert.throws()`. If the returned function has not been
- called exactly `exact` number of times when the test is complete, then the
- test will fail.
-
-If `fn` is provided, it will be passed to `assert.throws` as first argument.
-
-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).
+ If `fn` is provided, it will be passed to `assert.throws` as first argument
+ and `undefined` will be returned.
+ Otherwise a function suitable as callback or for use as a validation function
+ passed as the second argument to `assert.throws()` will be returned. If the
+ returned function has not been called exactly `exact` number of times when the
+ test is complete, then the test will fail.
### expectWarning(name, expected)
* `name` [<String>]