jest
jest copied to clipboard
[Bug]: Errors in `AggregateError` not displayed properly
Version
29.7.0
Steps to reproduce
See https://github.com/loozhengyuan/repro-jest-aggregateerror/actions/runs/6918600341/job/18821023498
Expected behavior
I expected to see each sub error nicely displayed.
Actual behavior
AggregateError:
at Function.Object.<anonymous>.AxiosError.from (node_modules/axios/lib/core/AxiosError.js:89:14)
Cause:
AggregateError:
Additional context
No response
Environment
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (4) x64 AMD EPYC 7763 64-Core Processor
Binaries:
Node: 20.9.0 - /opt/hostedtoolcache/node/20.9.0/x64/bin/node
Yarn: 1.22.21 - /usr/local/bin/yarn
npm: 10.1.0 - /opt/hostedtoolcache/node/20.9.0/x64/bin/npm
npmPackages:
jest: ^29.7.0 => 29.7.0
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Indeed this is still happening, and since the original "AggregatedError" is encapsulated in an AxiosError you'll need to handle it as duck-typed:
try {
// ...
catch (e) {
let errMsg = e.errors ? e.errors.map((err) => err.toString()).join(', ') : e.toString();
// ...
}
This is also happening for raw AggregateErrors as well, that at least should work.
PR very much welcome!
IDK what is going on but I am hitting the same roadblocker and IDK for how long we are gonna have this issue :disappointed: