Fixed de-duplication of exception messages containing blank lines on Node and Chrome

This is particularly helpful when reporting testing-library errors, which
have messages that contain blank lines and can be hundreds or even thousands
of lines long.
This commit is contained in:
Steve Gravrock
2024-10-07 20:04:07 -07:00
parent dda25bb29e
commit 84c7e2b21b
3 changed files with 31 additions and 6 deletions

View File

@@ -1,8 +1,6 @@
getJasmineRequireObj().StackTrace = function(j$) {
function StackTrace(error) {
let lines = error.stack.split('\n').filter(function(line) {
return line !== '';
});
let lines = error.stack.split('\n');
const extractResult = extractMessage(error.message, lines);
@@ -11,6 +9,10 @@ getJasmineRequireObj().StackTrace = function(j$) {
lines = extractResult.remainder;
}
lines = lines.filter(function(line) {
return line !== '';
});
const parseResult = tryParseFrames(lines);
this.frames = parseResult.frames;
this.style = parseResult.style;