jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: Errors in `AggregateError` not displayed properly

Open loozhengyuan opened this issue 1 year ago • 5 comments

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

loozhengyuan avatar Nov 19 '23 05:11 loozhengyuan

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.

github-actions[bot] avatar Dec 19 '23 06:12 github-actions[bot]

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.

github-actions[bot] avatar Jan 19 '24 11:01 github-actions[bot]

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();
  // ...
}

estani avatar Jan 23 '24 11:01 estani

This is also happening for raw AggregateErrors as well, that at least should work.

mscharley avatar Feb 06 '24 05:02 mscharley

PR very much welcome!

SimenB avatar Feb 06 '24 07:02 SimenB

IDK what is going on but I am hitting the same roadblocker and IDK for how long we are gonna have this issue :disappointed:

kasir-barati avatar Mar 31 '24 08:03 kasir-barati