Skip to content

Commit 64e4b0c

Browse files
addaleaxTrott
authored andcommitted
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: #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>
1 parent 48e13d2 commit 64e4b0c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/internal/assert/assertion_error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const kReadableOperator = {
2222
notStrictEqualObject:
2323
'Expected "actual" not to be reference-equal to "expected":',
2424
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
25-
notIdentical: 'Values identical but not reference-equal:',
25+
notIdentical: 'Values have same structure but are not reference-equal:',
2626
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:'
2727
};
2828

test/parallel/test-assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ assert.throws(() => { throw null; }, 'foo');
11011101
assert.throws(
11021102
() => assert.strictEqual([], []),
11031103
{
1104-
message: 'Values identical but not reference-equal:\n\n[]\n'
1104+
message: 'Values have same structure but are not reference-equal:\n\n[]\n'
11051105
}
11061106
);
11071107

0 commit comments

Comments
 (0)