Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ class MiniReporter {
}

if (test.error.stack) {
status += '\n' + indentString(colors.errorStack(extractStack(test.error.stack)), 2);
const extracted = extractStack(test.error.stack);
if (extracted.includes('\n')) {
status += '\n' + indentString(colors.errorStack(extracted), 2);
}
}
});
}
Expand Down
5 changes: 4 additions & 1 deletion lib/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ class VerboseReporter {
}

if (test.error.stack) {
output += '\n' + indentString(colors.errorStack(extractStack(test.error.stack)), 2);
const extracted = extractStack(test.error.stack);
if (extracted.includes('\n')) {
output += '\n' + indentString(colors.errorStack(extracted), 2);
}
}
});
}
Expand Down
16 changes: 4 additions & 12 deletions test/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,7 @@ test('results with errors', t => {
indentString(codeExcerpt(err2Path, err2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(err2), 2).split('\n'),
/failure two/,
'',
stackLineRegex
/failure two/
]));
t.end();
});
Expand Down Expand Up @@ -467,9 +465,7 @@ test('results with errors and disabled code excerpts', t => {
indentString(codeExcerpt(err2Path, err2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(err2), 2).split('\n'),
/failure two/,
'',
stackLineRegex
/failure two/
]));
t.end();
});
Expand Down Expand Up @@ -531,9 +527,7 @@ test('results with errors and broken code excerpts', t => {
indentString(codeExcerpt(err2Path, err2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(err2), 2).split('\n'),
/failure two/,
'',
stackLineRegex
/failure two/
]));
t.end();
});
Expand Down Expand Up @@ -596,9 +590,7 @@ test('results with errors and disabled assert output', t => {
indentString(codeExcerpt(err2Path, err2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(err2), 2).split('\n'),
/failure two/,
'',
stackLineRegex
/failure two/
]));
t.end();
});
Expand Down
16 changes: 4 additions & 12 deletions test/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,7 @@ test('results with errors', t => {
indentString(codeExcerpt(err2Path, error2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(error2), 2).split('\n'),
/error two message/,
'',
stackLineRegex
/error two message/
]));
t.end();
});
Expand Down Expand Up @@ -471,9 +469,7 @@ test('results with errors and disabled code excerpts', t => {
indentString(codeExcerpt(err2Path, error2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(error2), 2).split('\n'),
/error two message/,
'',
stackLineRegex
/error two message/
]));
t.end();
});
Expand Down Expand Up @@ -532,9 +528,7 @@ test('results with errors and disabled code excerpts', t => {
indentString(codeExcerpt(err2Path, error2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(error2), 2).split('\n'),
/error two message/,
'',
stackLineRegex
/error two message/
]));
t.end();
});
Expand Down Expand Up @@ -594,9 +588,7 @@ test('results with errors and disabled assert output', t => {
indentString(codeExcerpt(err2Path, error2.source.line), 2).split('\n'),
'',
indentString(formatAssertError(error2), 2).split('\n'),
/error two message/,
'',
stackLineRegex
/error two message/
]));
t.end();
});
Expand Down