-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvitest.config.ts
More file actions
45 lines (43 loc) · 1.58 KB
/
Copy pathvitest.config.ts
File metadata and controls
45 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
const resolvePath = (relativePath: string) =>
fileURLToPath(new URL(relativePath, import.meta.url))
export default defineConfig({
resolve: {
alias: [
{ find: /^@\/app\/(.*)$/, replacement: `${resolvePath('./app')}/$1` },
{ find: /^@\/lib\/(.*)$/, replacement: `${resolvePath('./lib')}/$1` },
{ find: /^@\/pages\/(.*)$/, replacement: `${resolvePath('./pages')}/$1` },
{ find: /^@\/(.*)$/, replacement: `${resolvePath('.')}/$1` }
]
},
test: {
globals: true,
// Default environment is node; component tests opt into jsdom per file via
// a `@vitest-environment jsdom` docblock (vitest 4 removed
// `environmentMatchGlobs`). `environmentOptions` still applies to whichever
// environment a test selects, so jsdom tests get the localhost:3000 URL.
environment: 'node',
environmentOptions: {
jsdom: { url: 'http://localhost:3000' }
},
// jest-global.ts must run first: it installs the minimal global `jest`
// shim that jest-fetch-mock (imported by vitest.setup.ts) relies on.
setupFiles: ['./vitest-shims/jest-global.ts', './vitest.setup.ts'],
include: ['**/*.test.{ts,tsx}'],
exclude: [
'**/node_modules/**',
'**/.next/**',
'**/.claude/**',
'**/.claire/**',
'**/coverage/**'
],
testTimeout: 30000,
server: {
deps: {
// These ship ESM that should be transformed/inlined by Vitest.
inline: ['better-auth', '@better-auth', 'html-react-parser', 'uuid']
}
}
}
})