mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
assert: fix the string length check for printing the simple diff
PR-URL: https://github.com/nodejs/node/pull/55474 Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
1 parent
81859cf01f
commit
10cce655ca
3 files changed
+31
-16
No files matched your search
@@ -134,7 +134,14 @@ function getStackedDiff(actual, expected) {
|
||||
}
|
||||
|
||||
function getSimpleDiff(originalActual, actual, originalExpected, expected) {
|
||||
const stringsLen = actual.length + expected.length;
|
||||
let stringsLen = actual.length + expected.length;
|
||||
// Accounting for the quotes wrapping strings
|
||||
if (typeof originalActual === 'string') {
|
||||
stringsLen -= 2;
|
||||
}
|
||||
if (typeof originalExpected === 'string') {
|
||||
stringsLen -= 2;
|
||||
}
|
||||
if (stringsLen <= kMaxShortStringLength && (originalActual !== 0 || originalExpected !== 0)) {
|
||||
return { message: `${actual} !== ${expected}`, header: '' };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user