Skip to content

Commit 4075348

Browse files
committed
doc: add information about Assert behavior and maintenance
Ref: #3124 Ref: #3122
1 parent 0f99320 commit 4075348

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

doc/api/assert.markdown

+13-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
Stability: 2 - Stable
44

5-
This module is used for writing assertion tests. You can access it with
6-
`require('assert')`.
5+
This module is used so that Node.js can test itself. You can access it with
6+
`require('assert')`. However, it is recommended that you use a userland
7+
assertion library instead.
78

89
## assert.fail(actual, expected, message, operator)
910

@@ -26,8 +27,16 @@ Tests shallow, coercive inequality with the not equal comparison operator
2627

2728
## assert.deepEqual(actual, expected[, message])
2829

29-
Tests for deep equality. Primitive values are compared with the equal comparison
30-
operator ( `==` ). Doesn't take object prototypes into account.
30+
Tests for deep equality. Primitive values are compared with the equal
31+
comparison operator ( `==` ).
32+
33+
This only considers enumerable properties. It does not test object prototypes,
34+
attached symbols, or non-enumerable properties. This can lead to some
35+
potentially surprising results. For this does not throw an `AssertionError`
36+
because the properties on the `Error` object are non-enumerable:
37+
38+
// WARNING: This probably does not do what you expect!
39+
assert.deepEqual(Error('a'), Error('b'));
3140

3241
## assert.notDeepEqual(actual, expected[, message])
3342

0 commit comments

Comments
 (0)