Open
Description
Version
29.7.0
Steps to reproduce
- Clone https://github.com/OliverJAsh/jest-aggregate-error-after-all
npm install
npm run test
Expected behavior
The AggregateError
details are displayed.
Actual behavior
The AggregateError
details are not displayed.
$ npm run test
> test
> jest
FAIL ./test.js
● Test suite failed to run
AggregateError:
4 |
5 | // Example
> 6 | afterAll(() => Promise.reject(new AggregateError(errors)));
| ^
7 |
8 | it("works", () => {
9 | expect(1).toEqual(1);
at Object.<anonymous> (test.js:6:31)
Test Suites: 1 failed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.147 s, estimated 1 s
Ran all test suites.
Additional context
Related but not the same: #14704. #15346 fixed this in toThrowMatchers
. However, the issue I am describing is different. This is about the appearance of unhandled errors rather than toThrowMatchers
errors.
I believe the AggregateError
is converted to a string
at this step, via getErrorStack
:
jest/packages/jest-circus/src/utils.ts
Line 323 in edee3ab
Environment
I don't think this is relevant but in any case:
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 22.14.0 - /nix/store/g5bv4gi6p7ryhs2hbaryxs6ivsxa6lqc-nodejs-22.14.0/bin/node
npm: 10.9.2 - /nix/store/g5bv4gi6p7ryhs2hbaryxs6ivsxa6lqc-nodejs-22.14.0/bin/npm
npmPackages:
jest: ^30.0.0 => 30.0.0