node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

using mock fake timers, block creating a new connection

Open dnetherton opened this issue 1 year ago • 0 comments

Description

Perhaps not so much as a bug -- but a testing issue.

Recently updated to 1.5.8 of @redis/client and found one of my project's integration test was now timing out.

Against 1.5.7 - had no issues.

Identified that my mocking of setImmediate was causing the connect() function to be blocked (its promise never resolves)

My simple workaround was to exclude setImmediate from being mocked.

Using mocha/sinon/ sinonFakeTimers

I don't see this so much as a 'bug' - but it just got me this afternoon - so I thought I'd share in case there is a better way to resolve my specific issue - and also sharing in case other might encounter this situation.

Just to be clear - this is my project's integration tests - nothing to do with the redis' tests.

Node.js Version

18.17.0

Redis Server Version

redis:7.0.4-alpine

Node Redis Version

1.5.8

Platform

linux

Logs

No response

dnetherton avatar Aug 03 '23 06:08 dnetherton