Skip to content

Commit 9dda72c

Browse files
committed
vitest now resolves alias paths
1 parent b1b9933 commit 9dda72c

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

pnpm-lock.yaml

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
packages:
2-
- "services/*"
2+
- "services"

services/src/user/user-service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// TODO: Investigate why vitest integration tests doesn't work with path aliases
2-
//import { compare, hash } from 'services/crypto/hash'
3-
import { compare, hash } from '../crypto/hash'
1+
import { compare, hash } from 'services/crypto/hash'
42
import type { ChangePasswordPayload } from '$components/container/profile/schema'
5-
import { omit } from '../util/omit'
3+
import { omit } from 'services/util/omit'
64
import type { SelectableUser, User } from './user'
75
import { changeUserPasswordById, deleteUserById, getUserById } from './user-repository'
86

vitest.workspace.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ import { defineWorkspace } from 'vitest/config'
33
// defineWorkspace provides a nice type hinting DX
44
export default defineWorkspace([
55
{
6+
extends: './vite.config.ts',
67
test: {
78
include: ['src/**/*.unit.test.ts', 'services/**/*.unit.test.ts'],
89
name: 'unit'
910
}
1011
},
1112
{
13+
extends: './vite.config.ts',
1214
test: {
1315
include: ['src/**/*.integration.test.ts', 'services/**/*.integration.test.ts'],
14-
name: 'integration'
16+
name: 'integration',
17+
environment: 'node'
1518
}
1619
}
1720
])

0 commit comments

Comments
 (0)