Closed kolodny closed 6 years ago
lolex
is the module powering sinon
fake timers so this issue affects anyone using sinon
fake timers too.
you probably want to open something on process-nextick-args
On Mon, Dec 4, 2017 at 11:19 PM Moshe Kolodny notifications@github.com wrote:
lolex is the module powering sinon fake timers so this issue affects anyone using sinon fake timers too.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nodejs/readable-stream/issues/316#issuecomment-349190828, or mute the thread https://github.com/notifications/unsubscribe-auth/ABE4n7r-YZjpNEL7Ag4qdP9aFCkc5Fh3ks5s9MRCgaJpZM4Q1tTY .
reopening as we now need to update process.nextick-args
Hey, I can fix this from the lolex side (I wrote the nextTick part there) - is this still an issue?
Note lolex doesn't override microtask stuff by default.
Yeah, this is still an issue. I resorted to patching the relevant files until the nextTick fixes makes it's way to node, but fixing it in lolex would be better. I didn't realize that was an option
I'm not sure I understand the issue completely - but I'm willing to patch it on either side (lolex or Node.js). How would a fix from the lolex side look like?
I'm not sure how to go about a fix from the lolex
side, I think that readable-stream
needs to update the dependency of process-nextick-args
Consider the following mocha test file
When the
clock
calls are removed and this runs using regular time this runs and finishes as expected and without errors. However when running with lolexinstall
ed it just hangs after loggingcreating stream2
. This is due to https://github.com/nodejs/readable-stream/blob/d6c391d7101946c8b8b97914fc46fd3322c450d1/lib/_stream_readable.js#L983 which retains a reference to the non swapped out version ofprocess.nextTick
due to use ofprocess-nextick-args
https://github.com/nodejs/readable-stream/blob/d6c391d7101946c8b8b97914fc46fd3322c450d1/lib/_stream_readable.js#L26A simple solution can be swapping
require('process-nextick-args')
withrequire('./process-nextick-args')
which can look something like this:Does that sound like a reasonable solution?