Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test to allow later Mocha #2018

Open
wbt opened this issue Jan 10, 2022 · 1 comment · May be fixed by #2020
Open

Update test to allow later Mocha #2018

wbt opened this issue Jan 10, 2022 · 1 comment · May be fixed by #2020
Labels
Good First Issue Good issue for new contributors

Comments

@wbt
Copy link
Contributor

wbt commented Jan 10, 2022

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.

@fearphage
Copy link
Contributor

This test is bad/broken. It isn't testing anything.

This is the end of the test:

helpers.reject('wtf this rejection').then(done());

None of the code in the write callback is being executed. The way done() is being called ends the test. It looks like it has never actually done anything. I'm looking into it.

@fearphage fearphage linked a pull request Jan 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good issue for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants