Skip to content

Commit d3426ee

Browse files
addaleaxtargos
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 e0951c8 commit d3426ee

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
@@ -1100,7 +1100,7 @@ assert.throws(() => { throw null; }, 'foo');
11001100
assert.throws(
11011101
() => assert.strictEqual([], []),
11021102
{
1103-
message: 'Values identical but not reference-equal:\n\n[]\n'
1103+
message: 'Values have same structure but are not reference-equal:\n\n[]\n'
11041104
}
11051105
);
11061106

0 commit comments

Comments
 (0)