We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 452eed9 commit cc1eae9Copy full SHA for cc1eae9
lib/internal/errors.js
@@ -342,11 +342,14 @@ class AssertionError extends Error {
342
red = '\u001b[31m';
343
}
344
const util = lazyUtil();
345
-
346
- if (actual && actual.stack && actual instanceof Error)
+ if (typeof actual === 'object' && actual !== null &&
+ 'stack' in actual && actual instanceof Error) {
347
actual = `${actual.name}: ${actual.message}`;
348
- if (expected && expected.stack && expected instanceof Error)
+ }
349
+ if (typeof expected === 'object' && expected !== null &&
350
+ 'stack' in expected && expected instanceof Error) {
351
expected = `${expected.name}: ${expected.message}`;
352
353
354
if (errorDiff === 0) {
355
let res = util.inspect(actual);
0 commit comments