-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Unified Handler Tests #2020
Conversation
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'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no 😢
test/helpers/handlers.js
Outdated
it('.handle()', function (done) { | ||
var msg = new Date().toString(); | ||
var writeable = helpers.writeable(function (info) { | ||
console.log('in writeable', info); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😞
There was a problem hiding this 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!
Fixes #2018