@@ -160,6 +160,10 @@ An alias of [`assert.ok()`][].
160160<!-- YAML
161161added: v0.1.21
162162changes:
163+ - version: REPLACEME
164+ pr-url: https://github.com/nodejs/node/pull/30766
165+ description: NaN is now treated as being identical in case both sides are
166+ NaN.
163167 - version: v12.0.0
164168 pr-url: https://github.com/nodejs/node/pull/25008
165169 description: The type tags are now properly compared and there are a couple
@@ -203,7 +207,8 @@ are also recursively evaluated by the following rules.
203207### Comparison details
204208
205209* Primitive values are compared with the [ Abstract Equality Comparison] [ ]
206- ( ` == ` ).
210+ ( ` == ` ) with the exception of ` NaN ` . It is treated as being identical in case
211+ both sides are ` NaN ` .
207212* [ Type tags] [ Object.prototype.toString() ] of objects should be the same.
208213* Only [ enumerable "own" properties] [ ] are considered.
209214* [ ` Error ` ] [ ] names and messages are always compared, even if these are not
@@ -554,6 +559,11 @@ assert.doesNotThrow(
554559## assert.equal(actual, expected\[ , message\] )
555560<!-- YAML
556561added: v0.1.21
562+ changes:
563+ - version: REPLACEME
564+ pr-url: https://github.com/nodejs/node/pull/30766
565+ description: NaN is now treated as being identical in case both sides are
566+ NaN.
557567-->
558568
559569* ` actual ` {any}
@@ -569,7 +579,8 @@ An alias of [`assert.strictEqual()`][].
569579> Stability: 0 - Deprecated: Use [ ` assert.strictEqual() ` ] [ ] instead.
570580
571581Tests shallow, coercive equality between the ` actual ` and ` expected ` parameters
572- using the [ Abstract Equality Comparison] [ ] ( ` == ` ).
582+ using the [ Abstract Equality Comparison] [ ] ( ` == ` ). ` NaN ` is special handled
583+ and treated as being identical in case both sides are ` NaN ` .
573584
574585``` js
575586const assert = require (' assert' );
@@ -578,6 +589,8 @@ assert.equal(1, 1);
578589// OK, 1 == 1
579590assert .equal (1 , ' 1' );
580591// OK, 1 == '1'
592+ assert .equal (NaN , NaN );
593+ // OK
581594
582595assert .equal (1 , 2 );
583596// AssertionError: 1 == 2
@@ -732,6 +745,10 @@ let err;
732745<!-- YAML
733746added: v0.1.21
734747changes:
748+ - version: REPLACEME
749+ pr-url: https://github.com/nodejs/node/pull/30766
750+ description: NaN is now treated as being identical in case both sides are
751+ NaN.
735752 - version: v9.0.0
736753 pr-url: https://github.com/nodejs/node/pull/15001
737754 description: The `Error` names and messages are now properly compared
@@ -853,6 +870,11 @@ instead of the [`AssertionError`][].
853870## assert.notEqual(actual, expected\[ , message\] )
854871<!-- YAML
855872added: v0.1.21
873+ changes:
874+ - version: REPLACEME
875+ pr-url: https://github.com/nodejs/node/pull/30766
876+ description: NaN is now treated as being identical in case both sides are
877+ NaN.
856878-->
857879
858880* ` actual ` {any}
@@ -868,7 +890,8 @@ An alias of [`assert.notStrictEqual()`][].
868890> Stability: 0 - Deprecated: Use [ ` assert.notStrictEqual() ` ] [ ] instead.
869891
870892Tests shallow, coercive inequality with the [ Abstract Equality Comparison] [ ]
871- ( ` != ` ).
893+ (` != ` ). ` NaN ` is special handled and treated as being identical in case both
894+ sides are ` NaN ` .
872895
873896``` js
874897const assert = require (' assert' );
0 commit comments