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

Unified Handler Tests #2020

Merged
merged 11 commits into from
Sep 28, 2024
Merged

Unified Handler Tests #2020

merged 11 commits into from
Sep 28, 2024

Conversation

fearphage
Copy link
Contributor

Fixes #2018

@fearphage
Copy link
Contributor Author

The current set of changes fail identically (due to timeout) in all versions of Mocha.

@@ -100,7 +98,7 @@ helpers.clearExceptions = function () {
*/
helpers.clearRejections = function () {
var listeners = process.listeners('unhandledRejection');
process.removeAllListeners('unhandledRejections');
process.removeAllListeners('unhandledRejection');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the real problem with the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no 😢

it('.handle()', function (done) {
var msg = new Date().toString();
var writeable = helpers.writeable(function (info) {
console.log('in writeable', info);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Called as expected for the exception handler but never for the rejection handler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense... excellent eye @fearphage 💯 Does this allow tests to pass in mocha@9 (or whatever the latest version is)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, these changes cause the rejection handler test to fail consistently (due to timeout) accross all versions of Mocha (8 and 9).

So this appears to be a code issue and the previously bad test hid this for a while. I don't know if this is a test problem or a code problem.

The event is attached to the handler (as confirmed by the tests), but firing the appropriate event doesn't trigger the stream to be written. I don't get it. I could use another set of eyes on it for sure.

Copy link
Contributor Author

@fearphage fearphage Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wbt @DABH Anything jump out as broken or misspelled here? I'm stuck.

Either the test is bad OR the code is bad... or possibly both. I'm going to take a break and circle back to it in a day or two to see if that gives me some perspective.

Edit: This test passes for the exception handler, but only fails for the rejection handler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I have not had time to look into this, and I'm not super optimistic about being able to give much time to this over the next few days at least 😞

@wbt
Copy link
Contributor

wbt commented Jan 13, 2022

#1673 and/or #1847 might be relevant here; #1801 tangentially so?

@fearphage fearphage changed the title WIP: Fixing a bad test Unified Handler Tests Aug 11, 2024
@fearphage fearphage marked this pull request as ready for review August 11, 2024 18:17
@fearphage fearphage requested review from wbt and DABH August 17, 2024 15:13
Copy link
Contributor

@DABH DABH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good and is a nice quality improvement to these tests. And looks like all the tests pass. Thank you @fearphage for your patience and persistence with this PR, and excited to merge it at last!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update test to allow later Mocha
3 participants