Skip to content

High performance self-hosted photo and video management solution.

chore: vitest 4 for web, cli, and e2e (#26668)

Daniel Dietzler3c476b1987d1
diff --git a/cli/package.json b/cli/package.json
index ad3d1307fd..aed8be5bba 100644
--- a/cli/package.json
+++ b/cli/package.json
@@ -21,7 +21,7 @@
"@types/micromatch": "^4.0.9",
"@types/mock-fs": "^4.13.1",
"@types/node": "^24.10.14",
- "@vitest/coverage-v8": "^3.0.0",
+ "@vitest/coverage-v8": "^4.0.0",
"byte-size": "^9.0.0",
"cli-progress": "^3.12.0",
"commander": "^12.0.0",
@@ -37,7 +37,7 @@
"typescript-eslint": "^8.28.0",
"vite": "^7.0.0",
"vite-tsconfig-paths": "^6.0.0",
- "vitest": "^3.0.0",
+ "vitest": "^4.0.0",
"vitest-fetch-mock": "^0.4.0",
"yaml": "^2.3.1"
},
diff --git a/cli/src/commands/asset.spec.ts b/cli/src/commands/asset.spec.ts
index ea57eeb74b..21700ef963 100644
--- a/cli/src/commands/asset.spec.ts
+++ b/cli/src/commands/asset.spec.ts
@@ -1,6 +1,6 @@
-import * as fs from 'node:fs';
-import * as os from 'node:os';
-import * as path from 'node:path';
+import fs from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
import { setTimeout as sleep } from 'node:timers/promises';
import { describe, expect, it, MockedFunction, vi } from 'vitest';
@@ -58,7 +58,7 @@ describe('uploadFiles', () => {
});
it('returns new assets when upload file is successful', async () => {
- fetchMocker.doMockIf(new RegExp(`${baseUrl}/assets$`), () => {
+ fetchMocker.doMockIf(new RegExp(`${baseUrl}/assets$`), function () {
return {
status: 200,
body: JSON.stringify({ id: 'fc5621b1-86f6-44a1-9905-403e607df9f5', status: 'created' }),
@@ -75,7 +75,7 @@ describe('uploadFiles', () => {
it('returns new assets when upload file retry is successful', async () => {
let counter = 0;
- fetchMocker.doMockIf(new RegExp(`${baseUrl}/assets$`), () => {
+ fetchMocker.doMockIf(new RegExp(`${baseUrl}/assets$`), function () {
counter++;
if (counter < retry) {
throw new Error('Network error');
@@ -96,7 +96,7 @@ describe('uploadFiles', () => {
});
it('returns new assets when upload file retry is failed', async () => {
- fetchMocker.doMockIf(new RegExp(`${baseUrl}/assets$`), () => {
+ fetchMocker.doMockIf(new RegExp(`${baseUrl}/assets$`), function () {
throw new Error('Network error');
});
@@ -236,16 +236,19 @@ describe('startWatch', () => {
await sleep(100); // to debounce the watcher from considering the test file as a existing file
await fs.promises.writeFile(testFilePath, 'testjpg');
- await vi.waitUntil(() => checkBulkUploadMocked.mock.calls.length > 0, 3000);
- expect(checkBulkUpload).toHaveBeenCalledWith({
- assetBulkUploadCheckDto: {
- assets: [
- expect.objectContaining({
- id: testFilePath,
- }),
- ],
- },
- });
+ await vi.waitFor(
+ () =>
+ expect(checkBulkUpload).toHaveBeenCalledWith({
+ assetBulkUploadCheckDto: {
+ assets: [
+ expect.objectContaining({
+ id: testFilePath,
+ }),
+ ],
+ },
+ }),
+ { timeout: 5000 },
+ );
});
it('should filter out unsupported files', async () => {
@@ -257,16 +260,19 @@ describe('startWatch', () => {
await fs.promises.writeFile(testFilePath, 'testjpg');
await fs.promises.writeFile(unsupportedFilePath, 'testtxt');
- await vi.waitUntil(() => checkBulkUploadMocked.mock.calls.length > 0, 3000);
- expect(checkBulkUpload).toHaveBeenCalledWith({
- assetBulkUploadCheckDto: {
- assets: expect.arrayContaining([
- expect.objectContaining({
- id: testFilePath,
- }),
- ]),
- },
- });
+ await vi.waitFor(
+ () =>
+ expect(checkBulkUpload).toHaveBeenCalledWith({
+ assetBulkUploadCheckDto: {
+ assets: expect.arrayContaining([
+ expect.objectContaining({
+ id: testFilePath,
+ }),
+ ]),
+ },
+ }),
+ { timeout: 5000 },
+ );
expect(checkBulkUpload).not.toHaveBeenCalledWith({
assetBulkUploadCheckDto: {
@@ -291,16 +297,19 @@ describe('startWatch', () => {
await fs.promises.writeFile(testFilePath, 'testjpg');
await fs.promises.writeFile(ignoredFilePath, 'ignoredjpg');
- await vi.waitUntil(() => checkBulkUploadMocked.mock.calls.length > 0, 3000);
- expect(checkBulkUpload).toHaveBeenCalledWith({
- assetBulkUploadCheckDto: {
- assets: expect.arrayContaining([
- expect.objectContaining({
- id: testFilePath,
- }),
- ]),
- },
- });
+ await vi.waitFor(
+ () =>
+ expect(checkBulkUpload).toHaveBeenCalledWith({
+ assetBulkUploadCheckDto: {
+ assets: expect.arrayContaining([
+ expect.objectContaining({
+ id: testFilePath,
+ }),
+ ]),
+ },
+ }),
+ { timeout: 5000 },
+ );
expect(checkBulkUpload).not.toHaveBeenCalledWith({
assetBulkUploadCheckDto: {
diff --git a/cli/vite.config.ts b/cli/vite.config.ts
index f538a9a357..c69b467011 100644
--- a/cli/vite.config.ts
+++ b/cli/vite.config.ts
@@ -1,4 +1,4 @@
-import { defineConfig } from 'vite';
+import { defineConfig, UserConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
@@ -17,4 +17,8 @@ export default defineConfig({
noExternal: /^(?!node:).*$/,
},
plugins: [tsconfigPaths()],
-});
+ test: {
+ name: 'cli:unit',
+ globals: true,
+ },
+} as UserConfig);
diff --git a/cli/vitest.config.ts b/cli/vitest.config.ts
deleted file mode 100644
index f444068181..0000000000
--- a/cli/vitest.config.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { defineConfig } from 'vitest/config';
-
-export default defineConfig({
- test: {
- name: 'cli:unit',
- globals: true,
- },
-});
diff --git a/e2e/package.json b/e2e/package.json
index 640b812165..962cf86ea3 100644
--- a/e2e/package.json
+++ b/e2e/package.json
@@ -27,7 +27,7 @@
"@eslint/js": "^10.0.0",
"@faker-js/faker": "^10.1.0",
"@immich/cli": "workspace:*",
- "@immich/e2e-auth-server": "workspace:*",
+ "@immich/e2e-auth-server": "workspace:*",
"@immich/sdk": "workspace:*",
"@playwright/test": "^1.44.1",
"@socket.io/component-emitter": "^3.1.2",
@@ -54,7 +54,8 @@
"typescript": "^5.3.3",
"typescript-eslint": "^8.28.0",
"utimes": "^5.2.1",
- "vitest": "^3.0.0"
+ "vite-tsconfig-paths": "^6.1.1",
+ "vitest": "^4.0.0"
},
"volta": {
"node": "24.13.1"
diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json
index bfad377089..f6efbf41e9 100644
--- a/e2e/tsconfig.json
+++ b/e2e/tsconfig.json
@@ -17,6 +17,6 @@
"esModuleInterop": true,
"baseUrl": "./"
},
- "include": ["src/**/*.ts"],
+ "include": ["src/**/*.ts", "vitest*.config.ts"],
"exclude": ["dist", "node_modules"]
}
diff --git a/e2e/vitest.config.ts b/e2e/vitest.config.ts
index 10f3aa3e4f..17ece152d7 100644
--- a/e2e/vitest.config.ts
+++ b/e2e/vitest.config.ts
@@ -1,3 +1,4 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
const skipDockerSetup = process.env.VITEST_DISABLE_DOCKER_SETUP === 'true';
@@ -20,10 +21,8 @@ export default defineConfig({
globalSetup,
testTimeout: 15_000,
pool: 'threads',
- poolOptions: {
- threads: {
- singleThread: true,
- },
- },
+ maxWorkers: 1,
+ isolate: false,
},
+ plugins: [tsconfigPaths()],
});
diff --git a/e2e/vitest.maintenance.config.ts b/e2e/vitest.maintenance.config.ts
index 665b908184..a6e96ccc0a 100644
--- a/e2e/vitest.maintenance.config.ts
+++ b/e2e/vitest.maintenance.config.ts
@@ -1,3 +1,4 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
const skipDockerSetup = process.env.VITEST_DISABLE_DOCKER_SETUP === 'true';
@@ -20,10 +21,8 @@ export default defineConfig({
globalSetup,
testTimeout: 15_000,
pool: 'threads',
- poolOptions: {
- threads: {
- singleThread: true,
- },
- },
+ maxWorkers: 1,
+ isolate: false,
},
+ plugins: [tsconfigPaths()],
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f6f3c0f461..a026d30d90 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -66,8 +66,8 @@ importers:
specifier: ^24.10.14
version: 24.11.0
'@vitest/coverage-v8':
- specifier: ^3.0.0
+ specifier: ^4.0.0
byte-size:
specifier: ^9.0.0
version: 9.0.1
@@ -114,11 +114,11 @@ importers:
specifier: ^6.0.0
vitest:
- specifier: ^3.0.0
+ specifier: ^4.0.0
vitest-fetch-mock:
specifier: ^0.4.0
yaml:
specifier: ^2.3.1
version: 2.8.2
@@ -285,9 +285,12 @@ importers:
utimes:
specifier: ^5.2.1
version: 5.2.1([email protected])
+ vite-tsconfig-paths:
+ specifier: ^6.1.1
vitest:
- specifier: ^3.0.0
+ specifier: ^4.0.0
e2e-auth-server:
devDependencies:
@@ -884,7 +887,7 @@ importers:
version: 6.9.1
'@testing-library/svelte':
specifier: ^5.2.8
'@testing-library/user-event':
specifier: ^14.5.2
version: 14.6.1(@testing-library/[email protected])
@@ -907,8 +910,8 @@ importers:
specifier: ^1.5.5
version: 1.5.6
'@vitest/coverage-v8':
- specifier: ^3.0.0
+ specifier: ^4.0.0
dotenv:
specifier: ^17.0.0
version: 17.3.1
@@ -970,8 +973,8 @@ importers:
specifier: ^7.1.2
vitest:
- specifier: ^3.0.0
+ specifier: ^4.0.0
packages:
@@ -5195,9 +5198,21 @@ packages:
'@vitest/browser':
optional: true
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-EYHLqN/BY6b47qHH7gtMxAg++saoGmsjWmAq9MlXxAz4M0NcHh9iOyKhBZyU4yxZqOd8Xnqp80/5saeitz4Cng==}
+ peerDependencies:
+ '@vitest/browser': 4.0.14
+ vitest: 4.0.14
+ peerDependenciesMeta:
+ '@vitest/browser':
+ optional: true
+
'@vitest/[email protected]':
resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-RHk63V3zvRiYOWAV0rGEBRO820ce17hz7cI2kDmEdfQsBjT2luEKB5tCOc91u1oSQoUOZkSv3ZyzkdkSLD7lKw==}
+
'@vitest/[email protected]':
resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==}
peerDependencies:
@@ -5209,21 +5224,47 @@ packages:
vite:
optional: true
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-RzS5NujlCzeRPF1MK7MXLiEFpkIXeMdQ+rN3Kk3tDI9j0mtbr7Nmuq67tpkOJQpgyClbOltCXMjLZicJHsH5Cg==}
+ peerDependencies:
+ msw: ^2.4.9
+ vite: ^6.0.0 || ^7.0.0-0
+ peerDependenciesMeta:
+ msw:
+ optional: true
+ vite:
+ optional: true
+
'@vitest/[email protected]':
resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==}
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-SOYPgujB6TITcJxgd3wmsLl+wZv+fy3av2PpiPpsWPZ6J1ySUYfScfpIt2Yv56ShJXR2MOA6q2KjKHN4EpdyRQ==}
+
'@vitest/[email protected]':
resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==}
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-BsAIk3FAqxICqREbX8SetIteT8PiaUL/tgJjmhxJhCsigmzzH8xeadtp7LRnTpCVzvf0ib9BgAfKJHuhNllKLw==}
+
'@vitest/[email protected]':
resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==}
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-aQVBfT1PMzDSA16Y3Fp45a0q8nKexx6N5Amw3MX55BeTeZpoC08fGqEZqVmPcqN0ueZsuUQ9rriPMhZ3Mu19Ag==}
+
'@vitest/[email protected]':
resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==}
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-JmAZT1UtZooO0tpY3GRyiC/8W7dCs05UOq9rfsUUgEZEdq+DuHLmWhPsrTt0TiW7WYeL/hXpaE07AZ2RCk44hg==}
+
'@vitest/[email protected]':
resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==}
+ '@vitest/[email protected]':
+ resolution: {integrity: sha512-hLqXZKAWNg8pI+SQXyXxWCTOpA3MvsqcbVeNgSi8x/CSN2wi26dSzn1wrOhmCmFjEvN9p8/kLFRHa6PI8jHazw==}
+
'@webassemblyjs/[email protected]':
resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==}
@@ -5833,6 +5874,10 @@ packages:
resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-p4Z49OGG5W/WBCPSS/dH3jQ73kD6tiMmUM+bckNK6Jr5JHMG3k9bg/BvKR8lKmtVBKmOiuVaV2ws8s9oSbwysg==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
@@ -5863,8 +5908,8 @@ packages:
resolution: {integrity: sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==}
- resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==}
+ resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==}
engines: {node: '>= 16'}
@@ -7175,8 +7220,8 @@ packages:
resolution: {integrity: sha512-orD61HdNcdlegfD80wI+3JE/n+iobYPztpFqv2drLHb1rb2QEKR1QY62r+O0wZHHNIf3Bje+xjweS1hxWignQA==}
engines: {node: '>=20.0.0'}
- resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==}
+ resolution: {integrity: sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==}
engines: {node: '>=12.0.0'}
@@ -8605,6 +8650,9 @@ packages:
resolution: {integrity: sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==}
+ resolution: {integrity: sha512-xrHS24IxaLrvuo613F719wvOIv9xPHFWQHuvGUBmPnCA/3MQxKI3b+r7n1jAoDHmsbC5bRhTZYR77invLAxVnw==}
+
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
engines: {node: '>=8'}
@@ -11295,8 +11343,8 @@ packages:
engines: {node: '>=10'}
hasBin: true
- resolution: {integrity: sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==}
+ resolution: {integrity: sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==}
engines: {node: '>=18'}
@@ -11379,6 +11427,10 @@ packages:
resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}
engines: {node: '>=14.0.0'}
+ resolution: {integrity: sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==}
+ engines: {node: '>=14.0.0'}
+
resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==}
engines: {node: '>=14.0.0'}
@@ -11863,6 +11915,40 @@ packages:
jsdom:
optional: true
+ resolution: {integrity: sha512-d9B2J9Cm9dN9+6nxMnnNJKJCtcyKfnHj15N6YNJfaFHRLua/d3sRKU9RuKmO9mB0XdFtUizlxfz/VPbd3OxGhw==}
+ engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0}
+ hasBin: true
+ peerDependencies:
+ '@edge-runtime/vm': '*'
+ '@opentelemetry/api': ^1.9.0
+ '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0
+ '@vitest/browser-playwright': 4.0.14
+ '@vitest/browser-preview': 4.0.14
+ '@vitest/browser-webdriverio': 4.0.14
+ '@vitest/ui': 4.0.14
+ happy-dom: '*'
+ jsdom: '*'
+ peerDependenciesMeta:
+ '@edge-runtime/vm':
+ optional: true
+ '@opentelemetry/api':
+ optional: true
+ '@types/node':
+ optional: true
+ '@vitest/browser-playwright':
+ optional: true
+ '@vitest/browser-preview':
+ optional: true
+ '@vitest/browser-webdriverio':
+ optional: true
+ '@vitest/ui':
+ optional: true
+ happy-dom:
+ optional: true
+ jsdom:
+ optional: true
+
resolution: {integrity: sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==}
engines: {node: '>=14.0.0'}
@@ -16513,14 +16599,14 @@ snapshots:
dependencies:
svelte: 5.53.5
dependencies:
'@testing-library/dom': 10.4.1
'@testing-library/svelte-core': 1.0.0([email protected])
svelte: 5.53.5
optionalDependencies:
'@testing-library/[email protected](@testing-library/[email protected])':
dependencies:
@@ -17227,28 +17313,43 @@ snapshots:
magic-string: 0.30.21
magicast: 0.3.5
std-env: 3.10.0
- test-exclude: 7.0.1
+ test-exclude: 7.0.2
tinyrainbow: 2.0.0
transitivePeerDependencies:
- supports-color
dependencies:
- '@ampproject/remapping': 2.3.0
'@bcoe/v8-coverage': 1.0.2
+ '@vitest/utils': 4.0.14
ast-v8-to-istanbul: 0.3.8
- debug: 4.4.3
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
istanbul-lib-source-maps: 5.0.6
istanbul-reports: 3.2.0
- magic-string: 0.30.21
- magicast: 0.3.5
+ magicast: 0.5.1
+ obug: 2.1.1
std-env: 3.10.0
- test-exclude: 7.0.1
- tinyrainbow: 2.0.0
+ tinyrainbow: 3.0.3
+ transitivePeerDependencies:
+ - supports-color
+
+ dependencies:
+ '@bcoe/v8-coverage': 1.0.2
+ '@vitest/utils': 4.0.14
+ ast-v8-to-istanbul: 0.3.8
+ istanbul-lib-coverage: 3.2.2
+ istanbul-lib-report: 3.0.1
+ istanbul-lib-source-maps: 5.0.6
+ istanbul-reports: 3.2.0
+ magicast: 0.5.1
+ obug: 2.1.1
+ std-env: 3.10.0
+ tinyrainbow: 3.0.3
transitivePeerDependencies:
- supports-color
@@ -17260,6 +17361,15 @@ snapshots:
chai: 5.3.3
tinyrainbow: 2.0.0
+ '@vitest/[email protected]':
+ dependencies:
+ '@standard-schema/spec': 1.1.0
+ '@types/chai': 5.2.3
+ '@vitest/spy': 4.0.14
+ '@vitest/utils': 4.0.14
+ chai: 6.2.1
+ tinyrainbow: 3.0.3
+
dependencies:
'@vitest/spy': 3.2.4
@@ -17268,9 +17378,17 @@ snapshots:
optionalDependencies:
dependencies:
- '@vitest/spy': 3.2.4
+ '@vitest/spy': 4.0.14
+ estree-walker: 3.0.3
+ magic-string: 0.30.21
+ optionalDependencies:
+
+ dependencies:
+ '@vitest/spy': 4.0.14
estree-walker: 3.0.3
magic-string: 0.30.21
optionalDependencies:
@@ -17280,28 +17398,50 @@ snapshots:
dependencies:
tinyrainbow: 2.0.0
+ '@vitest/[email protected]':
+ dependencies:
+ tinyrainbow: 3.0.3
+
'@vitest/[email protected]':
dependencies:
'@vitest/utils': 3.2.4
pathe: 2.0.3
strip-literal: 3.1.0
+ '@vitest/[email protected]':
+ dependencies:
+ '@vitest/utils': 4.0.14
+ pathe: 2.0.3
+
'@vitest/[email protected]':
dependencies:
'@vitest/pretty-format': 3.2.4
magic-string: 0.30.21
pathe: 2.0.3
+ '@vitest/[email protected]':
+ dependencies:
+ '@vitest/pretty-format': 4.0.14
+ magic-string: 0.30.21
+ pathe: 2.0.3
+
'@vitest/[email protected]':
dependencies:
tinyspy: 4.0.4
+ '@vitest/[email protected]': {}
+
'@vitest/[email protected]':
dependencies:
'@vitest/pretty-format': 3.2.4
loupe: 3.2.1
tinyrainbow: 2.0.0
+ '@vitest/[email protected]':
+ dependencies:
+ '@vitest/pretty-format': 4.0.14
+ tinyrainbow: 3.0.3
+
'@webassemblyjs/[email protected]':
dependencies:
'@webassemblyjs/helper-numbers': 1.13.2
@@ -18000,11 +18140,13 @@ snapshots:
dependencies:
assertion-error: 2.0.1
- check-error: 2.1.1
+ check-error: 2.1.3
deep-eql: 5.0.2
loupe: 3.2.1
pathval: 2.0.1
+
dependencies:
ansi-styles: 4.3.0
@@ -18026,7 +18168,7 @@ snapshots:
dependencies:
@@ -19496,7 +19638,7 @@ snapshots:
optionalDependencies:
exiftool-vendored.exe: 13.51.0
@@ -21122,6 +21264,12 @@ snapshots:
'@babel/types': 7.28.5
source-map-js: 1.2.1
+ dependencies:
+ '@babel/parser': 7.28.5
+ '@babel/types': 7.28.5
+ source-map-js: 1.2.1
+
dependencies:
semver: 6.3.1
@@ -24567,11 +24715,11 @@ snapshots:
commander: 2.20.3
source-map-support: 0.5.21
dependencies:
'@istanbuljs/schema': 0.1.3
glob: 10.5.0
- minimatch: 9.0.6
+ minimatch: 10.2.4
dependencies:
@@ -24659,6 +24807,8 @@ snapshots:
+
@@ -25083,27 +25233,6 @@ snapshots:
- tsx
- yaml
- dependencies:
- cac: 6.7.14
- debug: 4.4.3
- es-module-lexer: 1.7.0
- pathe: 2.0.3
- transitivePeerDependencies:
- - '@types/node'
- - jiti
- - less
- - lightningcss
- - sass
- - sass-embedded
- - stylus
- - sugarss
- - supports-color
- - terser
- - tsx
- - yaml
-
dependencies:
debug: 4.4.3
@@ -25154,11 +25283,11 @@ snapshots:
optionalDependencies:
dependencies:
dependencies:
'@types/chai': 5.2.3
'@vitest/expect': 3.2.4
@@ -25170,7 +25299,7 @@ snapshots:
'@vitest/utils': 3.2.4
chai: 5.3.3
debug: 4.4.3
- expect-type: 1.3.0
+ expect-type: 1.2.2
magic-string: 0.30.21
pathe: 2.0.3
picomatch: 4.0.3
@@ -25187,7 +25316,7 @@ snapshots:
'@types/debug': 4.1.12
'@types/node': 24.11.0
happy-dom: 20.7.0
+ jsdom: 26.1.0([email protected])
transitivePeerDependencies:
- jiti
- less
@@ -25202,33 +25331,70 @@ snapshots:
- tsx
- yaml
dependencies:
- '@types/chai': 5.2.3
- '@vitest/expect': 3.2.4
- '@vitest/pretty-format': 3.2.4
- '@vitest/runner': 3.2.4
- '@vitest/snapshot': 3.2.4
- '@vitest/spy': 3.2.4
- '@vitest/utils': 3.2.4
- chai: 5.3.3
- debug: 4.4.3
- expect-type: 1.3.0
+ '@vitest/expect': 4.0.14
+ '@vitest/pretty-format': 4.0.14
+ '@vitest/runner': 4.0.14
+ '@vitest/snapshot': 4.0.14
+ '@vitest/spy': 4.0.14
+ '@vitest/utils': 4.0.14
+ es-module-lexer: 1.7.0
+ expect-type: 1.2.2
magic-string: 0.30.21
+ obug: 2.1.1
pathe: 2.0.3
picomatch: 4.0.3
std-env: 3.10.0
tinybench: 2.9.0
tinyexec: 0.3.2
tinyglobby: 0.2.15
- tinypool: 1.1.1
- tinyrainbow: 2.0.0
+ tinyrainbow: 3.0.3
why-is-node-running: 2.3.0
optionalDependencies:
- '@types/debug': 4.1.12
+ '@opentelemetry/api': 1.9.0
+ '@types/node': 24.11.0
+ happy-dom: 20.7.0
+ transitivePeerDependencies:
+ - jiti
+ - less
+ - lightningcss
+ - msw
+ - sass
+ - sass-embedded
+ - stylus
+ - sugarss
+ - terser
+ - tsx
+ - yaml
+
+ dependencies:
+ '@vitest/expect': 4.0.14
+ '@vitest/pretty-format': 4.0.14
+ '@vitest/runner': 4.0.14
+ '@vitest/snapshot': 4.0.14
+ '@vitest/spy': 4.0.14
+ '@vitest/utils': 4.0.14
+ es-module-lexer: 1.7.0
+ expect-type: 1.2.2
+ magic-string: 0.30.21
+ obug: 2.1.1
+ pathe: 2.0.3
+ picomatch: 4.0.3
+ std-env: 3.10.0
+ tinybench: 2.9.0
+ tinyexec: 0.3.2
+ tinyglobby: 0.2.15
+ tinyrainbow: 3.0.3
+ why-is-node-running: 2.3.0
+ optionalDependencies:
+ '@opentelemetry/api': 1.9.0
'@types/node': 24.11.0
happy-dom: 20.7.0
jsdom: 26.1.0([email protected])
@@ -25241,38 +25407,34 @@ snapshots:
- sass-embedded
- stylus
- sugarss
- - supports-color
- terser
- tsx
- yaml
dependencies:
- '@types/chai': 5.2.3
- '@vitest/expect': 3.2.4
- '@vitest/pretty-format': 3.2.4
- '@vitest/runner': 3.2.4
- '@vitest/snapshot': 3.2.4
- '@vitest/spy': 3.2.4
- '@vitest/utils': 3.2.4
- chai: 5.3.3
- debug: 4.4.3
- expect-type: 1.3.0
+ '@vitest/expect': 4.0.14
+ '@vitest/pretty-format': 4.0.14
+ '@vitest/runner': 4.0.14
+ '@vitest/snapshot': 4.0.14
+ '@vitest/spy': 4.0.14
+ '@vitest/utils': 4.0.14
+ es-module-lexer: 1.7.0
+ expect-type: 1.2.2
magic-string: 0.30.21
+ obug: 2.1.1
pathe: 2.0.3
picomatch: 4.0.3
std-env: 3.10.0
tinybench: 2.9.0
tinyexec: 0.3.2
tinyglobby: 0.2.15
- tinypool: 1.1.1
- tinyrainbow: 2.0.0
+ tinyrainbow: 3.0.3
why-is-node-running: 2.3.0
optionalDependencies:
- '@types/debug': 4.1.12
+ '@opentelemetry/api': 1.9.0
'@types/node': 25.3.3
happy-dom: 20.7.0
jsdom: 26.1.0([email protected])
@@ -25285,7 +25447,6 @@ snapshots:
- sass-embedded
- stylus
- sugarss
- - supports-color
- terser
- tsx
- yaml
diff --git a/web/package.json b/web/package.json
index 77e963b82c..5bec4e786b 100644
--- a/web/package.json
+++ b/web/package.json
@@ -83,7 +83,7 @@
"@types/lodash-es": "^4.17.12",
"@types/luxon": "^3.4.2",
"@types/qrcode": "^1.5.5",
- "@vitest/coverage-v8": "^3.0.0",
+ "@vitest/coverage-v8": "^4.0.0",
"dotenv": "^17.0.0",
"eslint": "^10.0.0",
"eslint-config-prettier": "^10.1.8",
@@ -105,7 +105,7 @@
"typescript": "^5.8.3",
"typescript-eslint": "^8.45.0",
"vite": "^7.1.2",
- "vitest": "^3.0.0"
+ "vitest": "^4.0.0"
},
"volta": {
"node": "24.13.1"
diff --git a/web/src/lib/__mocks__/animate.mock.ts b/web/src/lib/__mocks__/animate.mock.ts
index 5f0d367d86..76ac1318b7 100644
--- a/web/src/lib/__mocks__/animate.mock.ts
+++ b/web/src/lib/__mocks__/animate.mock.ts
@@ -2,7 +2,7 @@ import { tick } from 'svelte';
import { vi } from 'vitest';
export const getAnimateMock = () =>
- vi.fn().mockImplementation(() => {
+ vi.fn().mockImplementation(function () {
let onfinish: (() => void) | null = null;
void tick().then(() => onfinish?.());
diff --git a/web/src/lib/__mocks__/intersection-observer.mock.ts b/web/src/lib/__mocks__/intersection-observer.mock.ts
index 5565e9a139..9f3dc05dce 100644
--- a/web/src/lib/__mocks__/intersection-observer.mock.ts
+++ b/web/src/lib/__mocks__/intersection-observer.mock.ts
@@ -1,9 +1,11 @@
import { vi } from 'vitest';
export const getIntersectionObserverMock = () =>
- vi.fn(() => ({
- disconnect: vi.fn(),
- observe: vi.fn(),
- takeRecords: vi.fn(),
- unobserve: vi.fn(),
- }));
+ vi.fn(function () {
+ return {
+ disconnect: vi.fn(),
+ observe: vi.fn(),
+ takeRecords: vi.fn(),
+ unobserve: vi.fn(),
+ };
+ });
diff --git a/web/src/lib/__mocks__/resize-observer.mock.ts b/web/src/lib/__mocks__/resize-observer.mock.ts
index ffd1dad2fd..da4baef5ba 100644
--- a/web/src/lib/__mocks__/resize-observer.mock.ts
+++ b/web/src/lib/__mocks__/resize-observer.mock.ts
@@ -1,8 +1,10 @@
import { vi } from 'vitest';
export const getResizeObserverMock = () =>
- vi.fn(() => ({
- disconnect: vi.fn(),
- observe: vi.fn(),
- unobserve: vi.fn(),
- }));
+ vi.fn(function () {
+ return {
+ disconnect: vi.fn(),
+ observe: vi.fn(),
+ unobserve: vi.fn(),
+ };
+ });
diff --git a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.spec.ts b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.spec.ts
index 3f49e79ed4..08d0b9aceb 100644
--- a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.spec.ts
+++ b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.spec.ts
@@ -18,18 +18,19 @@ describe('AssetViewerNavBar component', () => {
};
beforeAll(() => {
- Element.prototype.animate = vi.fn().mockImplementation(() => ({
- cancel: () => {},
- }));
+ Element.prototype.animate = vi.fn().mockImplementation(function () {
+ return {
+ cancel: () => {},
+ };
+ });
vi.stubGlobal('ResizeObserver', getResizeObserverMock());
- vi.mock(import('$lib/managers/feature-flags-manager.svelte'), () => {
+ vi.mock(import('$lib/managers/feature-flags-manager.svelte'), function () {
return {
featureFlagsManager: {
init: vi.fn(),
loadFeatureFlags: vi.fn(),
- value: { trash: true, smartSearch: true },
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- } as any,
+ value: { smartSearch: true, trash: true },
+ } as never,
};
});
});
diff --git a/web/src/lib/components/assets/thumbnail/__test__/thumbnail.spec.ts b/web/src/lib/components/assets/thumbnail/__test__/thumbnail.spec.ts
index f8e5fe0efa..1d78e24935 100644
--- a/web/src/lib/components/assets/thumbnail/__test__/thumbnail.spec.ts
+++ b/web/src/lib/components/assets/thumbnail/__test__/thumbnail.spec.ts
@@ -8,16 +8,18 @@ vi.hoisted(() => {
Object.defineProperty(globalThis, 'matchMedia', {
writable: true,
enumerable: true,
- value: vi.fn().mockImplementation((query) => ({
- matches: false,
- media: query,
- onchange: null,
- addListener: vi.fn(), // deprecated
- removeListener: vi.fn(), // deprecated
- addEventListener: vi.fn(),
- removeEventListener: vi.fn(),
- dispatchEvent: vi.fn(),
- })),
+ value: vi.fn().mockImplementation(function (query) {
+ return {
+ matches: false,
+ media: query,
+ onchange: null,
+ addListener: vi.fn(), // deprecated
+ removeListener: vi.fn(), // deprecated
+ addEventListener: vi.fn(),
+ removeEventListener: vi.fn(),
+ dispatchEvent: vi.fn(),
+ };
+ }),
});
});
diff --git a/web/src/test-data/setup.ts b/web/src/test-data/setup.ts
index 7a94c54338..b3e6a094a8 100644
--- a/web/src/test-data/setup.ts
+++ b/web/src/test-data/setup.ts
@@ -3,19 +3,23 @@ import { init } from 'svelte-i18n';
beforeAll(async () => {
await init({ fallbackLocale: 'dev' });
- Element.prototype.animate = vi.fn().mockImplementation(() => ({ cancel: () => {}, finished: Promise.resolve() }));
+ Element.prototype.animate = vi.fn().mockImplementation(function () {
+ return { cancel: () => {}, finished: Promise.resolve() };
+ });
});
Object.defineProperty(globalThis, 'matchMedia', {
writable: true,
- value: vi.fn().mockImplementation((query) => ({
- matches: false,
- media: query,
- onchange: null,
- addEventListener: vi.fn(),
- removeEventListener: vi.fn(),
- dispatchEvent: vi.fn(),
- })),
+ value: vi.fn().mockImplementation(function (query) {
+ return {
+ matches: false,
+ media: query,
+ onchange: null,
+ addEventListener: vi.fn(),
+ removeEventListener: vi.fn(),
+ dispatchEvent: vi.fn(),
+ };
+ }),
});
vi.mock('$env/dynamic/public', () => {