Skip to content

Update test to allow later Mocha #2018

@wbt

Description

@wbt

On this line we are checking that the set of unhandled rejection listeners on the process matches a single-element set with the one listener we expect to be there:

assume(process.listeners('unhandledRejection')).deep.equals([

Mocha 8.2.0 introduced a change over 8.1.3 which adds a global listener for unhandled promise rejections which precedes the expected one in the set and makes the set a different size than what is expected. This breaks this test.

To fix the test, instead of comparing the set of global listeners to a fixed expected set, we should iterate over the listeners in the global set and just verify that the expected one is in there, ignoring any others that might also be.

Alongside this, the version of Mocha listed under devDependencies in package.json should be updated to 8.2.0. Then also test with the latest version of Mocha and if it still works, update that all the way to whatever the current version is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions