summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-04-26 03:14:47 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-04-29 17:05:51 +0200
commitf0a6cb0593eae7743edac8e7b3304a09dde2cba6 (patch)
tree7d94030550afa76b99a224e7f4488819fc872d14 /lib
parent564048dc2984c45884e5eb58c903f9a0ebe29ab4 (diff)
downloadandroid-node-v8-f0a6cb0593eae7743edac8e7b3304a09dde2cba6.tar.gz
android-node-v8-f0a6cb0593eae7743edac8e7b3304a09dde2cba6.tar.bz2
android-node-v8-f0a6cb0593eae7743edac8e7b3304a09dde2cba6.zip
assert: minor error message improvements
Adjust indentations and fix a typo. PR-URL: https://github.com/nodejs/node/pull/20315 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/errors.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 51acc211d9..f7b62c89d9 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -360,13 +360,10 @@ function createErrDiff(actual, expected, operator) {
// Strict equal with identical objects that are not identical by reference.
if (identical === maxLines) {
- let base = 'Input object identical but not reference equal:';
-
- if (operator !== 'strictEqual') {
- // This code path should not be possible to reach.
- // The output is identical but it is not clear why.
- base = 'Input objects not identical:';
- }
+ // E.g., assert.deepStrictEqual(Symbol(), Symbol())
+ const base = operator === 'strictEqual' ?
+ 'Input objects identical but not reference equal:' :
+ 'Input objects not identical:';
// We have to get the result again. The lines were all removed before.
const actualLines = inspectValue(actual);
@@ -380,7 +377,7 @@ function createErrDiff(actual, expected, operator) {
}
}
- return `${base}\n\n ${actualLines.join('\n ')}\n`;
+ return `${base}\n\n${actualLines.join('\n')}\n`;
}
return `${msg}${skipped ? skippedMsg : ''}\n${res}${other}${end}`;
}
@@ -448,7 +445,7 @@ class AssertionError extends Error {
if (res.length === 1) {
super(`${base} ${res[0]}`);
} else {
- super(`${base}\n\n ${res.join('\n ')}\n`);
+ super(`${base}\n\n${res.join('\n')}\n`);
}
} else {
let res = util.inspect(actual);