| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 34fdea1 commit dab8ab2
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -465,6 +465,9 @@ An alias of [`assert.ok()`][]. | |||
| 465 | 465 | <!-- YAML | |
| 466 | 466 | added: v0.1.21 | |
| 467 | 467 | changes: | |
| 468 | + - version: REPLACEME | ||
| 469 | + pr-url: https://github.com/nodejs/node/pull/41020 | ||
| 470 | + description: Regular expressions lastIndex property is now compared as well. | ||
| 468 | 471 | - version: | |
| 469 | 472 | - v16.0.0 | |
| 470 | 473 | - v14.18.0 | |
@@ -539,6 +542,8 @@ are also recursively evaluated by the following rules. | |||
| 539 | 542 | objects. | |
| 540 | 543 | * [`Symbol`][] properties are not compared. | |
| 541 | 544 | * [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. | |
| 545 | + * [`RegExp`][] lastIndex, flags and source are always compared, even if these | ||
| 546 | + are not enumerable properties. | ||
| 542 | 547 | ||
| 543 | 548 | The following example does not throw an [`AssertionError`][] because the | |
| 544 | 549 | primitives are considered equal by the [Abstract Equality Comparison][] | |
@@ -642,6 +647,9 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the | |||
| 642 | 647 | <!-- YAML | |
| 643 | 648 | added: v1.2.0 | |
| 644 | 649 | changes: | |
| 650 | + - version: REPLACEME | ||
| 651 | + pr-url: https://github.com/nodejs/node/pull/41020 | ||
| 652 | + description: Regular expressions lastIndex property is now compared as well. | ||
| 645 | 653 | - version: v9.0.0 | |
| 646 | 654 | pr-url: https://github.com/nodejs/node/pull/15169 | |
| 647 | 655 | description: Enumerable symbol properties are now compared. | |
@@ -697,6 +705,8 @@ are recursively evaluated also by the following rules. | |||
| 697 | 705 | reference. | |
| 698 | 706 | * [`WeakMap`][] and [`WeakSet`][] comparison does not rely on their values. See | |
| 699 | 707 | below for further details. | |
| 708 | + * [`RegExp`][] lastIndex, flags and source are always compared, even if these | ||
| 709 | + are not enumerable properties. | ||
| 700 | 710 | ||
| 701 | 711 | ```mjs | |
| 702 | 712 | import assert from 'assert/strict'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,7 +63,9 @@ const kIsMap = 3; | |||
| 63 | 63 | ||
| 64 | 64 | // Check if they have the same source and flags | |
| 65 | 65 | function areSimilarRegExps(a, b) { | |
| 66 | - return a.source === b.source && a.flags === b.flags; | ||
| 66 | + return a.source === b.source && | ||
| 67 | + a.flags === b.flags && | ||
| 68 | + a.lastIndex === b.lastIndex; | ||
| 67 | 69 | } | |
| 68 | 70 | ||
| 69 | 71 | function areSimilarFloatArrays(a, b) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -712,7 +712,7 @@ assertNotDeepOrStrict(/a/igm, /a/im); | |||
| 712 | 712 | { | |
| 713 | 713 | const re1 = /a/g; | |
| 714 | 714 | re1.lastIndex = 3; | |
| 715 | - assert.deepEqual(re1, /a/g); | ||
| 715 | + assert.notDeepEqual(re1, /a/g); | ||
| 716 | 716 | } | |
| 717 | 717 | ||
| 718 | 718 | assert.deepEqual(4, '4'); | |
@@ -852,7 +852,7 @@ assert.throws( | |||
| 852 | 852 | { | |
| 853 | 853 | const re1 = /a/; | |
| 854 | 854 | re1.lastIndex = 3; | |
| 855 | - assert.deepStrictEqual(re1, /a/); | ||
| 855 | + assert.notDeepStrictEqual(re1, /a/); | ||
| 856 | 856 | } | |
| 857 | 857 | ||
| 858 | 858 | assert.throws( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments