1
1
import { defineConfig } from 'vitest/config' ;
2
+ import vue from '@vitejs/plugin-vue' ;
3
+ import type { AliasOptions } from 'vite' ;
4
+ import { fileURLToPath } from 'node:url' ;
5
+
6
+ const vueVersion = ( process . env . VUE_VERSION as '3.4' | '3.5' ) ?? '3.5' ;
7
+
8
+ const alias : AliasOptions = [
9
+ ...( vueVersion === '3.4'
10
+ ? [
11
+ {
12
+ find : 'vue' ,
13
+ replacement : 'vue-3.4' ,
14
+ } ,
15
+ {
16
+ find : 'pinia' ,
17
+ replacement : 'pinia-2.2.5' ,
18
+ } ,
19
+ ]
20
+ : [ ] ) ,
21
+ {
22
+ find : / ^ @ r e g l e \/ ( .* ?) $ / ,
23
+ replacement : fileURLToPath ( new URL ( './packages/$1/src' , import . meta. url ) ) ,
24
+ } ,
25
+ ] ;
2
26
3
27
export default defineConfig ( {
4
28
test : {
@@ -9,5 +33,49 @@ export default defineConfig({
9
33
include : [ 'packages/*/src/**' ] ,
10
34
exclude : [ '**/*/index.ts' , '**/types/**' , '**/dist/**/*' , '**/*.d.ts' , '**/*.spec.ts' , 'packages/nuxt/dist/**' ] ,
11
35
} ,
36
+ projects : [
37
+ {
38
+ plugins : [ vue ( ) ] ,
39
+ extends : true ,
40
+ test : {
41
+ alias,
42
+ name : `Global tests - Vue ${ vueVersion } .x` ,
43
+ root : './tests' ,
44
+ environment : 'happy-dom' ,
45
+ include : [ '**/*.spec.ts' ] ,
46
+ } ,
47
+ } ,
48
+ {
49
+ plugins : [ vue ( ) ] ,
50
+ extends : true ,
51
+ test : {
52
+ alias,
53
+ name : `Rules tests - Vue ${ vueVersion } .x` ,
54
+ root : './packages/rules' ,
55
+ environment : 'happy-dom' ,
56
+ include : [ '**/*.spec.ts' ] ,
57
+ } ,
58
+ } ,
59
+ {
60
+ plugins : [ vue ( ) ] ,
61
+ extends : true ,
62
+ test : {
63
+ alias,
64
+ name : `Shared tests - Vue ${ vueVersion } .x` ,
65
+ root : './packages/shared' ,
66
+ environment : 'happy-dom' ,
67
+ include : [ '**/*.spec.ts' ] ,
68
+ } ,
69
+ } ,
70
+ {
71
+ extends : true ,
72
+ test : {
73
+ name : `Nuxt tests - Vue ${ vueVersion } .x` ,
74
+ root : './packages/nuxt' ,
75
+ testTimeout : 30000 ,
76
+ include : [ '**/*.{spec,test}.ts' ] ,
77
+ } ,
78
+ } ,
79
+ ] ,
12
80
} ,
13
81
} ) ;
0 commit comments