Răsfoiți Sursa

Merge pull request #29374 from overleaf/renovate-major-vitest-monorepo

chore(deps): update vitest monorepo to v4 from ^3.2.4 (major)

GitOrigin-RevId: 553a8fefadd82598a9ff4089ce468b59791e2d43
Andrew Rumble 9 luni în urmă
părinte
comite
0ca1888f76

+ 1 - 1
libraries/validation-tools/package.json

@@ -27,6 +27,6 @@
   },
   "devDependencies": {
     "typescript": "^5.0.4",
-    "vitest": "^3.2.4"
+    "vitest": "^4.0.0"
   }
 }

Fișier diff suprimat deoarece este prea mare
+ 869 - 15
package-lock.json


+ 1 - 1
services/docstore/package.json

@@ -48,6 +48,6 @@
     "sinon": "~9.0.2",
     "sinon-chai": "^3.7.0",
     "typescript": "^5.0.4",
-    "vitest": "^3.2.4"
+    "vitest": "^4.0.0"
   }
 }

+ 1 - 1
services/filestore/package.json

@@ -49,6 +49,6 @@
     "sinon-chai": "^3.7.0",
     "streamifier": "^0.1.1",
     "typescript": "^5.0.4",
-    "vitest": "^3.2.4"
+    "vitest": "^4.0.0"
   }
 }

+ 1 - 1
services/notifications/package.json

@@ -44,6 +44,6 @@
     "chai-as-promised": "^7.1.1",
     "mocha": "^11.1.0",
     "typescript": "^5.0.4",
-    "vitest": "^3.2.4"
+    "vitest": "^4.0.0"
   }
 }

+ 1 - 20
services/web/bin/test_unit_run_dir

@@ -13,24 +13,5 @@ fi
 
 echo "Running unit tests in directory: $*"
 
-npm run test:unit:parallel -- "${vitest_args[@]}"
-vitest_parallel_status=$?
+npm run test:unit -- "${vitest_args[@]}"
 
-npm run test:unit:sequential -- "${vitest_args[@]}"
-vitest_sequential_status=$?
-
-if [ "$vitest_sequential_status" -eq 0 ] && [ "$vitest_parallel_status" -eq 0 ]; then
-  exit 0
-fi
-
-# Report status briefly at the end for failures
-
-if [ "$vitest_parallel_status" -ne 0 ]; then
-  echo "Parallel tests failed with status: $vitest_parallel_status"
-fi
-
-if [ "$vitest_sequential_status" -ne 0 ]; then
-  echo "Sequential tests failed with status: $vitest_sequential_status"
-fi
-
-exit 1

+ 3 - 2
services/web/package.json

@@ -13,8 +13,9 @@
     "test:unit:all": "npm run test:unit:run_dir -- test/unit/src modules/*/test/unit/src",
     "test:unit:all:silent": "npm run test:unit:all -- --reporter dot",
     "test:unit:app": "npm run test:unit:run_dir -- test/unit/src",
+    "test:unit": "vitest run",
     "test:unit:parallel": "vitest run --project=Parallel",
-    "test:unit:sequential": "vitest run --project=Sequential --no-file-parallelism",
+    "test:unit:sequential": "vitest run --project=Sequential",
     "test:unit:watch": "vitest",
     "test:frontend": "NODE_ENV=test TZ=GMT mocha --recursive --timeout 5000 --exit --extension js,jsx,mjs,ts,tsx --grep=$MOCHA_GREP --require test/frontend/bootstrap.js --ignore '**/*.spec.{js,jsx,ts,tsx}' --ignore '**/helpers/**/*.{js,jsx,ts,tsx}' test/frontend modules/*/test/frontend",
     "test:frontend:coverage": "c8 --all --include 'frontend/js' --include 'modules/*/frontend/js' --exclude 'frontend/js/vendor' --reporter=lcov --reporter=text-summary npm run test:frontend",
@@ -408,7 +409,7 @@
     "typescript": "^5.8.3",
     "use-stick-to-bottom": "^1.1.1",
     "uuid": "^9.0.1",
-    "vitest": "^3.1.2",
+    "vitest": "^4.0.0",
     "w3c-keyname": "^2.2.8",
     "webpack": "^5.98.0",
     "webpack-assets-manifest": "^5.2.1",

+ 1 - 1
services/web/test/unit/bootstrap.mjs

@@ -52,7 +52,7 @@ beforeEach(ctx => {
 })
 
 afterEach(() => {
-  vi.restoreAllMocks()
+  vi.resetAllMocks()
   vi.resetModules()
   sinon.restore()
   const modelNames = mongoose.modelNames()

+ 3 - 1
services/web/test/unit/src/User/UserEmailsController.test.mjs

@@ -79,7 +79,9 @@ describe('UserEmailsController', function () {
       consume: vi.fn().mockResolvedValue(undefined),
     }
     ctx.RateLimiter = {
-      RateLimiter: vi.fn().mockReturnValue(ctx.rateLimiter),
+      RateLimiter: vi.fn().mockImplementation(function RateLimiter() {
+        this.consume = ctx.rateLimiter.consume
+      }),
     }
     ctx.AuthenticationController = {
       getRedirectFromSession: vi.fn().mockReturnValue(null),

+ 6 - 0
services/web/vitest.config.js

@@ -30,6 +30,9 @@ module.exports = defineConfig({
             'modules/*/test/unit/**/*.test.mjs',
             'test/unit/src/**/*.test.mjs',
           ],
+          sequence: {
+            groupOrder: 2,
+          },
           exclude: ['**/*.sequential.test.mjs'],
           fileParallelism: true,
         },
@@ -38,6 +41,9 @@ module.exports = defineConfig({
         extends: true,
         test: {
           name: 'Sequential',
+          sequence: {
+            groupOrder: 1,
+          },
           include: [
             'modules/*/test/unit/**/*.sequential.test.mjs',
             'test/unit/src/**/*.sequential.test.mjs',

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff