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
This commit is contained in:
Andrew Rumble
2025-12-17 16:56:52 +00:00
committed by Copybot
parent cbeb58cc0a
commit 0ca1888f76
10 changed files with 2701 additions and 54 deletions

View File

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

2709
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@@ -13,24 +13,5 @@ fi
echo "Running unit tests in directory: $*" echo "Running unit tests in directory: $*"
npm run test:unit:parallel -- "${vitest_args[@]}" npm run test:unit -- "${vitest_args[@]}"
vitest_parallel_status=$?
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

View File

@@ -13,8 +13,9 @@
"test:unit:all": "npm run test:unit:run_dir -- test/unit/src modules/*/test/unit/src", "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:all:silent": "npm run test:unit:all -- --reporter dot",
"test:unit:app": "npm run test:unit:run_dir -- test/unit/src", "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: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: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": "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", "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", "typescript": "^5.8.3",
"use-stick-to-bottom": "^1.1.1", "use-stick-to-bottom": "^1.1.1",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"vitest": "^3.1.2", "vitest": "^4.0.0",
"w3c-keyname": "^2.2.8", "w3c-keyname": "^2.2.8",
"webpack": "^5.98.0", "webpack": "^5.98.0",
"webpack-assets-manifest": "^5.2.1", "webpack-assets-manifest": "^5.2.1",

View File

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

View File

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

View File

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