Skip to content

Timeouts with TAP reporter result in AggregateError #3461

Description

@Comandeer

When using the TAP reporter, timeouts in tests result in the following error:

file:///usr/src/app/node_modules/emittery/index.js:785
                        throw new AggregateError(errors, 'One or more listeners threw an error');
                              ^

AggregateError: One or more listeners threw an error
    at RunStatus.emit (file:///usr/src/app/node_modules/emittery/index.js:785:10) {
  [errors]: [
    TypeError: Cannot set properties of undefined (setting 'stack')
        at dumpError (file:///usr/src/app/node_modules/ava/lib/reporters/tap.js:48:22)
        at TapReporter.writeTest (file:///usr/src/app/node_modules/ava/lib/reporters/tap.js:105:21)
        at TapReporter.writeTimeout (file:///usr/src/app/node_modules/ava/lib/reporters/tap.js:151:10)
        at TapReporter.consumeStateChange (file:///usr/src/app/node_modules/ava/lib/reporters/tap.js:217:10)
        at file:///usr/src/app/node_modules/ava/lib/reporters/tap.js:72:55
        at file:///usr/src/app/node_modules/emittery/index.js:769:13
        at Array.map (<anonymous>)
        at RunStatus.emit (file:///usr/src/app/node_modules/emittery/index.js:767:23)
  ]
}

This error prevents the reporter from outputting the standard summary of the test run.

Minimal reproduction: https://github.com/Comandeer/bugs-reports/tree/ava-timeout

The issue seems to be connected with setting the originalError.stack property, however the originalError is undefined – as writeTimeout() passes down a native Error object that lacks this property.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions