Skip to content

Commit 715a6bc

Browse files
test: fixed config
1 parent 0b8ba04 commit 715a6bc

File tree

2 files changed

+68
-66
lines changed

2 files changed

+68
-66
lines changed

vitest.config.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
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: /^@regle\/(.*?)$/,
23+
replacement: fileURLToPath(new URL('./packages/$1/src', import.meta.url)),
24+
},
25+
];
226

327
export default defineConfig({
428
test: {
@@ -9,5 +33,49 @@ export default defineConfig({
933
include: ['packages/*/src/**'],
1034
exclude: ['**/*/index.ts', '**/types/**', '**/dist/**/*', '**/*.d.ts', '**/*.spec.ts', 'packages/nuxt/dist/**'],
1135
},
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+
],
1280
},
1381
});

vitest.workspace.ts

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)