| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 086103b commit b607366
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,10 @@ | |||
| 1 | 1 | # Assert | |
| 2 | 2 | ||
| 3 | - Stability: 2 - Stable | ||
| 3 | + Stability: 3 - Locked | ||
| 4 | 4 | ||
| 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. It can be accessed with | ||
| 6 | + `require('assert')`. However, it is recommended that a userland assertion | ||
| 7 | + library be used instead. | ||
| 7 | 8 | ||
| 8 | 9 | ## assert.fail(actual, expected, message, operator) | |
| 9 | 10 | ||
@@ -26,8 +27,17 @@ Tests shallow, coercive inequality with the not equal comparison operator | |||
| 26 | 27 | ||
| 27 | 28 | ## assert.deepEqual(actual, expected[, message]) | |
| 28 | 29 | ||
| 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 example, this does not throw an | ||
| 36 | + `AssertionError` because the properties on the `Error` object are | ||
| 37 | + non-enumerable: | ||
| 38 | + | ||
| 39 | + // WARNING: This does not throw an AssertionError! | ||
| 40 | + assert.deepEqual(Error('a'), Error('b')); | ||
| 31 | 41 | ||
| 32 | 42 | ## assert.notDeepEqual(actual, expected[, message]) | |
| 33 | 43 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments