-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathvitest.config.ts
More file actions
89 lines (87 loc) · 2.03 KB
/
vitest.config.ts
File metadata and controls
89 lines (87 loc) · 2.03 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { defineConfig } from 'vitest/config'
import { fileURLToPath, URL } from 'node:url'
import { resolve } from 'node:path'
export default defineConfig({
define: {
__DEV__: 'true',
__TEST__: 'true',
__BROWSER__: 'true',
__USE_DEVTOOLS__: 'false',
},
resolve: {
alias: [
{
find: /^@pinia\/(.*?)$/,
replacement: fileURLToPath(
new URL('./packages/packages/$1/src', import.meta.url)
),
},
{
find: /^pinia$/,
replacement: fileURLToPath(
new URL('./packages/pinia/src', import.meta.url)
),
},
],
},
test: {
include: ['src/**/*.{test,spec}.ts', '__tests__/**/*.{test,spec}.ts'],
setupFiles: [
fileURLToPath(
new URL('./packages/pinia/__tests__/vitest-setup.ts', import.meta.url)
),
],
environment: 'happy-dom',
fakeTimers: {
// easier to read, some date in 2001
now: 1_000_000_000_000,
},
typecheck: {
enabled: true,
},
coverage: {
enabled: true,
provider: 'v8',
reporter: ['text', 'lcovonly', 'html'],
include: [
'packages/pinia/src',
// FIXME: enable when nuxt tests are fixed
// 'packages/nuxt/src',
'packages/testing/src',
],
exclude: [
'**/src/index.ts',
'**/*.test-d.ts',
'packages/pinia/src/devtools',
'packages/pinia/src/hmr.ts',
],
},
projects: [
{
extends: true,
test: {
name: 'pinia',
root: './packages/pinia',
},
},
// FIXME: doesn't work since last nuxt test-utils update
// {
// extends: true,
// test: {
// name: '@pinia/nuxt',
// root: './packages/nuxt',
// environment: 'node',
// include: ['test/**/*.{spec,test}.ts'],
// },
// },
{
extends: true,
test: {
name: '@pinia/testing',
root: './packages/testing',
globals: true,
},
},
],
},
})