Closed ewanharris closed 2 years ago
Sounds good to me. Needs a test that fails without the patch and passes with it, though.
I've added a test that overrides setTimeout to emulate running in environments that don't have unref. I'm not super familiar with tap so I'm not sure how to ensure that setTimeout gets reset if the test throws. Please let me know if you think there's a better way to have the test mock that behaviour
Thanks! I tweaked the test a little to put the reset into a t.teardown()
method, since that'll get called even if the test fails.
Environments like Electron do not always expose the Node.js setTiemout, so there is no unref function on resTimeout. So update the check to also check if the unref function exists
Ref: https://github.com/electron/electron/issues/21162