-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.mts
66 lines (56 loc) · 2.14 KB
/
vitest.config.mts
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
import fs from 'fs';
import path from 'path';
import vue from "@vitejs/plugin-vue";
import { defineConfig } from 'vite';
import type { UserConfigExport } from 'vite';
function generateConfig(): Promise<UserConfigExport> {
return new Promise((resolve, reject) => {
const exclude = [
'**/node_modules/**',
'**/dist/**',
'**/install/**',
'**/cypress/**',
'**/themes/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
];
const rawData = fs.readFileSync(path.join(__dirname, '.frontend-configuration-settings.json'), 'utf-8');
const parsedData = JSON.parse(rawData);
const alias: { [key: string]: string } = {
'@/arches': path.join(parsedData['ROOT_DIR'], 'app', 'src', 'arches'),
'arches': path.join(parsedData['ROOT_DIR'], 'app', 'media', 'js', 'arches.js'),
};
for (
const [archesApplicationName, archesApplicationPath]
of Object.entries(
parsedData['ARCHES_APPLICATIONS_PATHS'] as { [key: string]: string }
)
) {
alias[`@/${archesApplicationName}`] = path.join(archesApplicationPath, 'src', archesApplicationName);
}
resolve({
plugins: [vue()],
test: {
alias: alias,
coverage: {
include: [path.join('arches76', 'src', path.sep)],
exclude: exclude,
reporter: [
['clover', { 'file': 'coverage.xml' }],
'text',
],
reportsDirectory: path.join(__dirname, 'coverage', 'frontend'),
},
environment: "jsdom",
globals: true,
exclude: exclude,
passWithNoTests: true,
setupFiles: ['vitest.setup.mts'],
},
});
});
};
export default (async () => {
const config = await generateConfig();
return defineConfig(config);
})();