فهرست منبع

Add vitest check when initialising redis

This is similar to the Mocha checks and will error if a connection is
attempted.

GitOrigin-RevId: 35e73cb56dc7c72393c55f40b6c18e9aaf74ab50
Andrew Rumble 1 سال پیش
والد
کامیت
29d9408a69
1فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 3 2
      services/web/app/src/infrastructure/RedisWrapper.js

+ 3 - 2
services/web/app/src/infrastructure/RedisWrapper.js

@@ -3,8 +3,9 @@ const redis = require('@overleaf/redis-wrapper')
 const { addConnectionDrainer } = require('./GracefulShutdown')
 const { addConnectionDrainer } = require('./GracefulShutdown')
 
 
 if (
 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(
   throw new Error(
     'It looks like unit tests are running, but you are connecting to Redis. Missing a stub?'
     'It looks like unit tests are running, but you are connecting to Redis. Missing a stub?'