Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e52b2b0

Browse filesBrowse files
TrottMyles Borins
authored andcommitted
doc: add added: information for assert
PR-URL: #6688 Ref: #6578 Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Klauke <romaaan.git@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 8404e34 commit e52b2b0
Copy full SHA for e52b2b0

File tree

Expand file treeCollapse file tree

1 file changed

+42
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+42
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/assert.md‎

Copy file name to clipboardExpand all lines: doc/api/assert.md
+42Lines changed: 42 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ additions or changes to any of the methods implemented and exposed by
1313
the module.
1414

1515
## assert(value[, message])
16+
<!-- YAML
17+
added: v0.5.9
18+
-->
1619

1720
An alias of [`assert.ok()`][] .
1821

@@ -30,6 +33,9 @@ assert(false, 'it\'s false');
3033
```
3134

3235
## assert.deepEqual(actual, expected[, message])
36+
<!-- YAML
37+
added: v0.1.21
38+
-->
3339

3440
Tests for deep equality between the `actual` and `expected` parameters.
3541
Primitive values are compared with the equal comparison operator ( `==` ).
@@ -88,6 +94,9 @@ property set equal to the value of the `message` parameter. If the `message`
8894
parameter is undefined, a default error message is assigned.
8995

9096
## assert.deepStrictEqual(actual, expected[, message])
97+
<!-- YAML
98+
added: v1.2.0
99+
-->
91100

92101
Generally identical to `assert.deepEqual()` with two exceptions. First,
93102
primitive values are compared using the strict equality operator ( `===` ).
@@ -109,6 +118,9 @@ property set equal to the value of the `message` parameter. If the `message`
109118
parameter is undefined, a default error message is assigned.
110119

111120
## assert.doesNotThrow(block[, error][, message])
121+
<!-- YAML
122+
added: v0.1.21
123+
-->
112124

113125
Asserts that the function `block` does not throw an error. See
114126
[`assert.throws()`][] for more details.
@@ -161,6 +173,9 @@ assert.doesNotThrow(
161173
```
162174

163175
## assert.equal(actual, expected[, message])
176+
<!-- YAML
177+
added: v0.1.21
178+
-->
164179

165180
Tests shallow, coercive equality between the `actual` and `expected` parameters
166181
using the equal comparison operator ( `==` ).
@@ -184,6 +199,9 @@ property set equal to the value of the `message` parameter. If the `message`
184199
parameter is undefined, a default error message is assigned.
185200

186201
## assert.fail(actual, expected, message, operator)
202+
<!-- YAML
203+
added: v0.1.21
204+
-->
187205

188206
Throws an `AssertionError`. If `message` is falsy, the error message is set as
189207
the values of `actual` and `expected` separated by the provided `operator`.
@@ -200,6 +218,9 @@ assert.fail(1, 2, 'whoops', '>');
200218
```
201219

202220
## assert.ifError(value)
221+
<!-- YAML
222+
added: v0.1.97
223+
-->
203224

204225
Throws `value` if `value` is truthy. This is useful when testing the `error`
205226
argument in callbacks.
@@ -214,6 +235,9 @@ assert.ifError(new Error()); // Throws Error
214235
```
215236

216237
## assert.notDeepEqual(actual, expected[, message])
238+
<!-- YAML
239+
added: v0.1.21
240+
-->
217241

218242
Tests for any deep inequality. Opposite of [`assert.deepEqual()`][].
219243

@@ -255,6 +279,9 @@ property set equal to the value of the `message` parameter. If the `message`
255279
parameter is undefined, a default error message is assigned.
256280

257281
## assert.notDeepStrictEqual(actual, expected[, message])
282+
<!-- YAML
283+
added: v1.2.0
284+
-->
258285

259286
Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][].
260287

@@ -273,6 +300,9 @@ with a `message` property set equal to the value of the `message` parameter. If
273300
the `message` parameter is undefined, a default error message is assigned.
274301

275302
## assert.notEqual(actual, expected[, message])
303+
<!-- YAML
304+
added: v0.1.21
305+
-->
276306

277307
Tests shallow, coercive inequality with the not equal comparison operator
278308
( `!=` ).
@@ -295,6 +325,9 @@ property set equal to the value of the `message` parameter. If the `message`
295325
parameter is undefined, a default error message is assigned.
296326

297327
## assert.notStrictEqual(actual, expected[, message])
328+
<!-- YAML
329+
added: v0.1.21
330+
-->
298331

299332
Tests strict inequality as determined by the strict not equal operator
300333
( `!==` ).
@@ -317,6 +350,9 @@ If the values are strictly equal, an `AssertionError` is thrown with a
317350
`message` parameter is undefined, a default error message is assigned.
318351

319352
## assert.ok(value[, message])
353+
<!-- YAML
354+
added: v0.1.21
355+
-->
320356

321357
Tests if `value` is truthy. It is equivalent to
322358
`assert.equal(!!value, true, message)`.
@@ -339,6 +375,9 @@ assert.ok(false, 'it\'s false');
339375
```
340376

341377
## assert.strictEqual(actual, expected[, message])
378+
<!-- YAML
379+
added: v0.1.21
380+
-->
342381

343382
Tests strict equality as determined by the strict equality operator ( `===` ).
344383

@@ -360,6 +399,9 @@ If the values are not strictly equal, an `AssertionError` is thrown with a
360399
`message` parameter is undefined, a default error message is assigned.
361400

362401
## assert.throws(block[, error][, message])
402+
<!-- YAML
403+
added: v0.1.21
404+
-->
363405

364406
Expects the function `block` to throw an error.
365407

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.