diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-07-23 20:38:53 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-25 22:36:29 -0700 |
commit | 64e4b0c0ac5073e6606b1ccd79a464f2c5925741 (patch) | |
tree | db75e24484e4161ce7440b12df68b7c0494f1b9e | |
parent | 48e13d2adfa9b3b315a80aac16100b56aef94e4a (diff) | |
download | android-node-v8-64e4b0c0ac5073e6606b1ccd79a464f2c5925741.tar.gz android-node-v8-64e4b0c0ac5073e6606b1ccd79a464f2c5925741.tar.bz2 android-node-v8-64e4b0c0ac5073e6606b1ccd79a464f2c5925741.zip |
assert: avoid potentially misleading reference to object identity
Often, the word “identical” when referring to JS objects will
be read as referring to having the same object identity (which is
called “reference equality” here), but what the error message is
trying to say here is that the objects are different but yield the
same `util.inspect()` output.
Since `util.inspect()` output represents the structure rather than
the identity of objects, (hopefully) clarify the error message to
reflect that.
PR-URL: https://github.com/nodejs/node/pull/28824
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
-rw-r--r-- | lib/internal/assert/assertion_error.js | 2 | ||||
-rw-r--r-- | test/parallel/test-assert.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js index cdeba1941c..3734796e2d 100644 --- a/lib/internal/assert/assertion_error.js +++ b/lib/internal/assert/assertion_error.js @@ -22,7 +22,7 @@ const kReadableOperator = { notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', - notIdentical: 'Values identical but not reference-equal:', + notIdentical: 'Values have same structure but are not reference-equal:', notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:' }; diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 2959f54c7a..f65caac433 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -1101,7 +1101,7 @@ assert.throws(() => { throw null; }, 'foo'); assert.throws( () => assert.strictEqual([], []), { - message: 'Values identical but not reference-equal:\n\n[]\n' + message: 'Values have same structure but are not reference-equal:\n\n[]\n' } ); |