From 29d9408a695eb2dc0301d51b0a97476dced1ab3a Mon Sep 17 00:00:00 2001 From: Andrew Rumble Date: Tue, 15 Jul 2025 14:14:39 +0100 Subject: [PATCH] Add vitest check when initialising redis This is similar to the Mocha checks and will error if a connection is attempted. GitOrigin-RevId: 35e73cb56dc7c72393c55f40b6c18e9aaf74ab50 --- services/web/app/src/infrastructure/RedisWrapper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/web/app/src/infrastructure/RedisWrapper.js b/services/web/app/src/infrastructure/RedisWrapper.js index fecb00ab14..3017d03e47 100644 --- a/services/web/app/src/infrastructure/RedisWrapper.js +++ b/services/web/app/src/infrastructure/RedisWrapper.js @@ -3,8 +3,9 @@ const redis = require('@overleaf/redis-wrapper') const { addConnectionDrainer } = require('./GracefulShutdown') if ( - typeof global.beforeEach === 'function' && - process.argv.join(' ').match(/unit/) + (typeof global.beforeEach === 'function' && + process.argv.join(' ').match(/unit/)) || + process.env.VITEST ) { throw new Error( 'It looks like unit tests are running, but you are connecting to Redis. Missing a stub?'