mirror of
https://github.com/immich-app/immich.git
synced 2026-03-22 22:09:49 +03:00
feat: vitest 4
This commit is contained in:
@@ -121,7 +121,6 @@
|
||||
"@nestjs/cli": "^11.0.2",
|
||||
"@nestjs/schematics": "^11.0.0",
|
||||
"@nestjs/testing": "^11.0.4",
|
||||
"@swc/core": "^1.4.14",
|
||||
"@types/archiver": "^7.0.0",
|
||||
"@types/async-lock": "^1.4.2",
|
||||
"@types/bcrypt": "^6.0.0",
|
||||
@@ -146,7 +145,7 @@
|
||||
"@types/supertest": "^6.0.0",
|
||||
"@types/ua-parser-js": "^0.7.36",
|
||||
"@types/validator": "^13.15.2",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"@vitest/coverage-v8": "^4.1.0",
|
||||
"eslint": "^10.0.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
@@ -163,9 +162,8 @@
|
||||
"testcontainers": "^11.0.0",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.28.0",
|
||||
"unplugin-swc": "^1.4.5",
|
||||
"vite-tsconfig-paths": "^6.0.0",
|
||||
"vitest": "^3.0.0"
|
||||
"vite": "8.0.0",
|
||||
"vitest": "^4.1.0"
|
||||
},
|
||||
"volta": {
|
||||
"node": "24.13.1"
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { Kysely } from 'kysely';
|
||||
import { ConfigRepository } from 'src/repositories/config.repository';
|
||||
import { DatabaseRepository } from 'src/repositories/database.repository';
|
||||
import { LoggingRepository } from 'src/repositories/logging.repository';
|
||||
import { DB } from 'src/schema';
|
||||
import { getKyselyConfig } from 'src/utils/database';
|
||||
import { Migrator } from '@immich/sql-tools';
|
||||
import { join } from 'node:path';
|
||||
import { GenericContainer, Wait } from 'testcontainers';
|
||||
|
||||
const globalSetup = async () => {
|
||||
@@ -40,13 +36,15 @@ const globalSetup = async () => {
|
||||
|
||||
process.env.IMMICH_TEST_POSTGRES_URL = postgresUrl;
|
||||
|
||||
const db = new Kysely<DB>(getKyselyConfig({ connectionType: 'url', url: postgresUrl }));
|
||||
const migrator = new Migrator({
|
||||
allowUnorderedMigrations: false,
|
||||
connectionParams: { connectionType: 'url', url: postgresUrl },
|
||||
// eslint-disable-next-line unicorn/prefer-module
|
||||
migrationFolder: join(__dirname, '../../src/schema/migrations'),
|
||||
});
|
||||
await migrator.runMigrations();
|
||||
|
||||
const configRepository = new ConfigRepository();
|
||||
const logger = LoggingRepository.create();
|
||||
await new DatabaseRepository(db, logger, configRepository).runMigrations();
|
||||
|
||||
await db.destroy();
|
||||
await migrator.destroy();
|
||||
};
|
||||
|
||||
export default globalSetup;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import swc from 'unplugin-swc';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
const serverRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
@@ -19,5 +17,7 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [swc.vite(), tsconfigPaths()],
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import swc from 'unplugin-swc';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
const serverRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
export default defineConfig({
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
test: {
|
||||
name: 'server:unit',
|
||||
root: serverRoot,
|
||||
@@ -31,5 +32,4 @@ export default defineConfig({
|
||||
TZ: 'UTC',
|
||||
},
|
||||
},
|
||||
plugins: [swc.vite(), tsconfigPaths()],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user