Report the constituent errors of an AggregateError

Fixes #2063
This commit is contained in:
Charley
2026-02-05 20:50:32 -06:00
committed by Steve Gravrock
parent 1d0718dc2f
commit 319776d241
3 changed files with 265 additions and 1 deletions

View File

@@ -11,7 +11,8 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
'lineNumber',
'column',
'description',
'jasmineMessage'
'jasmineMessage',
'errors'
];
function ExceptionFormatter(options) {
@@ -77,6 +78,18 @@ getJasmineRequireObj().ExceptionFormatter = function(j$) {
lines = lines.concat(substack);
}
if (Array.isArray(error.errors)) {
error.errors.forEach((aggregatedError, index) => {
if (aggregatedError instanceof Error) {
const substack = this.stack_(aggregatedError, {
messageHandling: 'require'
});
substack[0] = 'Error ' + (index + 1) + ': ' + substack[0];
lines = lines.concat(substack);
}
});
}
return lines;
};