From c9e326b1c89f7df96df7c67dfceab2768c02b8a0 Mon Sep 17 00:00:00 2001 From: Sasan Jaghori Date: Fri, 19 Jul 2024 22:10:07 +0200 Subject: [PATCH] vitest now resolves alias paths --- pnpm-lock.yaml | 31 +++++++++++++++++++++++++++++++ pnpm-workspace.yaml | 2 +- services/src/user/user-service.ts | 6 ++---- vitest.workspace.js | 1 + 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 357051a1..e20a18b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -193,6 +193,37 @@ importers: specifier: ^2.0.0 version: 2.0.2(@types/node@20.14.10)(jsdom@24.1.0) + services: + dependencies: + bcrypt: + specifier: ^5.1.1 + version: 5.1.1 + better-sqlite3: + specifier: ^11.0.0 + version: 11.1.2 + jsonwebtoken: + specifier: ^9.0.2 + version: 9.0.2 + kysely: + specifier: ^0.27.3 + version: 0.27.4 + pino: + specifier: ^9.0.0 + version: 9.2.0 + pino-pretty: + specifier: ^11.0.0 + version: 11.2.1 + zod: + specifier: ^3.23.5 + version: 3.23.8 + devDependencies: + vite: + specifier: ^5.2.11 + version: 5.3.3(@types/node@20.14.10) + vitest: + specifier: ^2.0.0 + version: 2.0.2(@types/node@20.14.10)(jsdom@24.1.0) + packages: '@actions/core@1.10.1': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index a3250507..c778da07 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,2 +1,2 @@ packages: - - "services/*" + - "services" diff --git a/services/src/user/user-service.ts b/services/src/user/user-service.ts index 21a2ebd2..d9cdde44 100644 --- a/services/src/user/user-service.ts +++ b/services/src/user/user-service.ts @@ -1,8 +1,6 @@ -// TODO: Investigate why vitest integration tests doesn't work with path aliases -//import { compare, hash } from 'services/crypto/hash' -import { compare, hash } from '../crypto/hash' +import { compare, hash } from 'services/crypto/hash' import type { ChangePasswordPayload } from '$components/container/profile/schema' -import { omit } from '../util/omit' +import { omit } from 'services/util/omit' import type { SelectableUser, User } from './user' import { changeUserPasswordById, deleteUserById, getUserById } from './user-repository' diff --git a/vitest.workspace.js b/vitest.workspace.js index f211aa1d..8b09986e 100644 --- a/vitest.workspace.js +++ b/vitest.workspace.js @@ -9,6 +9,7 @@ export default defineWorkspace([ } }, { + extends: './vite.config.ts', test: { include: ['src/**/*.integration.test.ts', 'services/**/*.integration.test.ts'], name: 'integration'