We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c0c0e6 commit 8d33e5cCopy full SHA for 8d33e5c
lib/internal/errors.js
@@ -219,10 +219,14 @@ class AssertionError extends Error {
219
red = '\u001b[31m';
220
}
221
const util = lazyUtil();
222
- if (actual && actual.stack && actual instanceof Error)
+ if (typeof actual === 'object' && actual !== null &&
223
+ 'stack' in actual && actual instanceof Error) {
224
actual = `${actual.name}: ${actual.message}`;
- if (expected && expected.stack && expected instanceof Error)
225
+ }
226
+ if (typeof expected === 'object' && expected !== null &&
227
+ 'stack' in expected && expected instanceof Error) {
228
expected = `${expected.name}: ${expected.message}`;
229
230
231
if (errorDiff === 0) {
232
let res = util.inspect(actual);
0 commit comments