forked from toeverything/AFFiNE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitest.config.ts
52 lines (49 loc) · 1.67 KB
/
vitest.config.ts
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
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
const rootDir = fileURLToPath(new URL('.', import.meta.url));
const pluginOutputDir = resolve(rootDir, './apps/electron/dist/plugins');
export default defineConfig({
plugins: [react(), vanillaExtractPlugin()],
assetsInclude: ['**/*.md'],
resolve: {
alias: {
'next/router': 'next-router-mock',
'next/config': resolve(rootDir, './scripts/vitest/next-config-mock.ts'),
},
},
define: {
'process.env.PLUGIN_DIR': JSON.stringify(pluginOutputDir),
},
test: {
setupFiles: [
resolve(rootDir, './scripts/setup/lit.ts'),
resolve(rootDir, './scripts/setup/i18n.ts'),
resolve(rootDir, './scripts/setup/search.ts'),
resolve(rootDir, './scripts/setup/lottie-web.ts'),
resolve(rootDir, './scripts/setup/global.ts'),
],
// split tests that include native addons or not
include: process.env.NATIVE_TEST
? ['apps/electron/src/**/*.spec.ts']
: [
'packages/**/*.spec.ts',
'packages/**/*.spec.tsx',
'apps/web/**/*.spec.ts',
'apps/web/**/*.spec.tsx',
'tests/unit/**/*.spec.ts',
'tests/unit/**/*.spec.tsx',
],
exclude: ['**/node_modules', '**/dist', '**/build', '**/out'],
testTimeout: 5000,
singleThread: Boolean(process.env.NATIVE_TEST),
threads: !process.env.NATIVE_TEST,
coverage: {
provider: 'istanbul', // or 'c8'
reporter: ['lcov'],
reportsDirectory: '.coverage/store',
},
},
});