Skip to content

Commit d58b823

Browse files
committed
Allow hiding stack trace
Fixes error when stack trace is hidden with ```Error.stackTraceLimit = 0``` Potentially provides a fix to caolan#64
1 parent 60b7d67 commit d58b823

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ exports.betterErrors = function (assertion) {
205205
);
206206
var spacing = (multiline ? '\n' : ' ');
207207
e._message = e.message;
208+
// avoids error when stack trace is hidden with Error.stackTraceLimit
209+
e.stack = e.stack || '';
208210
e.stack = (
209211
e.name + ':' + spacing +
210212
actual + spacing + e.operator + spacing +

0 commit comments

Comments
 (0)