Skip to content

[Bug]: AggregateError.errors[] sub-errors are invisible in reporter output — only the top-level message is serialized #40856

@kumarchandresh

Description

@kumarchandresh

Version

1.58.2

Steps to reproduce

test('aggregate', async () => {
  throw new AggregateError(
    [new Error('cleanup 1 failed'), new Error('cleanup 2 failed')],
    'teardown failed'
  );
});

Expected behavior

Reporter shows teardown failed. The two sub-errors are gone.

Actual behavior

Would love if the .errors[] property gets injected into testInfo.errors[] or serialized in some way how the .cause property is serialized.

Additional context

AggregateError has been stable since Node 15 / ES2021 and is the idiomatic way to
surface multiple failures from a single operation (e.g. Promise.allSettled, fixture
teardown collecting cleanup errors). When one is thrown, Playwright's reporter shows
only the message — the errors[] array is silently dropped.

Root cause: filterStackTrace in util.ts explicitly recurses through e.cause
but never walks e.errors[]. One property is handled, the other isn't.

Environment

Platform: Windows 11
Node Package Manager: pnpm
Playwright: "@playwright/test": "1.58.2"

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions