@@ -104,7 +104,7 @@ more on color support in terminal environments, read the tty
104
104
105
105
## Legacy assertion mode
106
106
107
- Legacy assertion mode uses the [ Abstract Equality Comparison] [ ] in:
107
+ Legacy assertion mode uses the [ Abstract Equality Comparison] [ ] ( ` == ` ) in:
108
108
109
109
* [ ` assert.deepEqual() ` ] [ ]
110
110
* [ ` assert.equal() ` ] [ ]
@@ -121,13 +121,11 @@ import assert from 'assert';
121
121
const assert = require (' assert' );
122
122
```
123
123
124
- Whenever possible, use the [ strict assertion mode] [ ] instead. Otherwise, the
125
- [ Abstract Equality Comparison] [ ] may cause surprising results. This is
126
- especially true for [ ` assert.deepEqual() ` ] [ ] , where the comparison rules are
127
- lax:
124
+ Legacy assertion mode may have surprising results, especially when using
125
+ [ ` assert.deepEqual() ` ] [ ] :
128
126
129
127
``` cjs
130
- // WARNING: This does not throw an AssertionError!
128
+ // WARNING: This does not throw an AssertionError in legacy assertion mode !
131
129
assert .deepEqual (/ a/ gi , new Date ());
132
130
```
133
131
@@ -526,8 +524,8 @@ are also recursively evaluated by the following rules.
526
524
527
525
### Comparison details
528
526
529
- * Primitive values are compared with the [ Abstract Equality Comparison ] [ ]
530
- ( ` == ` ) with the exception of ` NaN ` . It is treated as being identical in case
527
+ * Primitive values are compared with the ` == ` operator,
528
+ with the exception of ` NaN ` . It is treated as being identical in case
531
529
both sides are ` NaN ` .
532
530
* [ Type tags] [ Object.prototype.toString() ] of objects should be the same.
533
531
* Only [ enumerable "own" properties] [ ] are considered.
@@ -546,8 +544,7 @@ are also recursively evaluated by the following rules.
546
544
are not enumerable properties.
547
545
548
546
The following example does not throw an [ ` AssertionError ` ] [ ] because the
549
- primitives are considered equal by the [ Abstract Equality Comparison] [ ]
550
- ( ` == ` ).
547
+ primitives are compared using the ` == ` operator.
551
548
552
549
``` mjs
553
550
import assert from ' assert' ;
@@ -1169,8 +1166,8 @@ An alias of [`assert.strictEqual()`][].
1169
1166
> Stability: 3 - Legacy: Use [ ` assert.strictEqual() ` ] [ ] instead.
1170
1167
1171
1168
Tests shallow, coercive equality between the ` actual ` and ` expected ` parameters
1172
- using the [ Abstract Equality Comparison] [ ] ( ` == ` ). ` NaN ` is special handled
1173
- and treated as being identical in case both sides are ` NaN ` .
1169
+ using the [ Abstract Equality Comparison] [ ] (` == ` ). ` NaN ` is specially handled
1170
+ and treated as being identical if both sides are ` NaN ` .
1174
1171
1175
1172
``` mjs
1176
1173
import assert from ' assert' ;
@@ -1688,7 +1685,7 @@ An alias of [`assert.notStrictEqual()`][].
1688
1685
> Stability: 3 - Legacy: Use [ ` assert.notStrictEqual() ` ] [ ] instead.
1689
1686
1690
1687
Tests shallow, coercive inequality with the [ Abstract Equality Comparison] [ ]
1691
- (` != ` ). ` NaN ` is special handled and treated as being identical in case both
1688
+ (` != ` ). ` NaN ` is specially handled and treated as being identical in case both
1692
1689
sides are ` NaN ` .
1693
1690
1694
1691
``` mjs
@@ -2448,7 +2445,7 @@ assert.throws(throwingFirst, /Second$/);
2448
2445
Due to the confusing error-prone notation, avoid a string as the second
2449
2446
argument.
2450
2447
2451
- [ Abstract Equality Comparison ] : https://tc39.github.io/ecma262 /#sec-abstract-equality-comparison
2448
+ [ Abstract Equality Comparison ] : https://262.ecma-international.org /#sec-abstract-equality-comparison
2452
2449
[ Object wrappers ] : https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript
2453
2450
[ Object.prototype.toString() ] : https://tc39.github.io/ecma262/#sec-object.prototype.tostring
2454
2451
[ SameValue Comparison ] : https://tc39.github.io/ecma262/#sec-samevalue
0 commit comments