You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: test/common/README.md
+28-15
Original file line number
Diff line number
Diff line change
@@ -51,28 +51,41 @@ Platform normalizes the `dd` command
51
51
Check if there is more than 1gb of total memory.
52
52
53
53
### expectsError([fn, ]settings[, exact])
54
-
*`fn`[<Function>]
54
+
*`fn`[<Function>] a function that should throw.
55
55
*`settings`[<Object>]
56
-
with the following optional properties:
56
+
that must contain the `code` property plus any of the other following
57
+
properties (some properties only apply for `AssertionError`):
57
58
*`code`[<String>]
58
-
expected error must have this value for its `code` property
59
+
expected error must have this value for its `code` property.
59
60
*`type`[<Function>]
60
-
expected error must be an instance of `type`
61
-
*`message`[<String>]
62
-
or [<RegExp>]
61
+
expected error must be an instance of `type` and must be an Error subclass.
62
+
*`message`[<String>] or [<RegExp>]
63
63
if a string is provided for `message`, expected error must have it for its
64
64
`message` property; if a regular expression is provided for `message`, the
65
-
regular expression must match the `message` property of the expected error
65
+
regular expression must match the `message` property of the expected error.
66
+
*`name`[<String>]
67
+
expected error must have this value for its `name` property.
68
+
*`generatedMessage`[<String>]
69
+
(`AssertionError` only) expected error must have this value for its
70
+
`generatedMessage` property.
71
+
*`actual`<any>
72
+
(`AssertionError` only) expected error must have this value for its
73
+
`actual` property.
74
+
*`expected`<any>
75
+
(`AssertionError` only) expected error must have this value for its
76
+
`expected` property.
77
+
*`operator`<any>
78
+
(`AssertionError` only) expected error must have this value for its
79
+
`operator` property.
66
80
*`exact`[<Number>] default = 1
81
+
* return [<Function>]
67
82
68
-
* return function suitable for use as a validation function passed as the second
69
-
argument to e.g. `assert.throws()`. If the returned function has not been
70
-
called exactly `exact` number of times when the test is complete, then the
71
-
test will fail.
72
-
73
-
If `fn` is provided, it will be passed to `assert.throws` as first argument.
74
-
75
-
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).
83
+
If `fn` is provided, it will be passed to `assert.throws` as first argument
84
+
and `undefined` will be returned.
85
+
Otherwise a function suitable as callback or for use as a validation function
86
+
passed as the second argument to `assert.throws()` will be returned. If the
87
+
returned function has not been called exactly `exact` number of times when the
0 commit comments