-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitest.config.ts
40 lines (36 loc) · 1.02 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
/// <reference types="vitest" />
import { type AliasOptions } from 'vite'
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import { resolve as pathResolve } from 'path'
import { compilerOptions } from './tsconfig.json'
// https://github.com/vitejs/vite/issues/88#issuecomment-864348862
const alias: AliasOptions = Object.entries(compilerOptions.paths).reduce(
(acc, [key, [value]]) => {
const aliasKey = key.substring(0, key.length - 2)
const path = value.substring(0, value.length - 2)
return {
...acc,
[aliasKey]: pathResolve(__dirname, path),
}
},
{}
)
export const plugins = [react()]
export const resolve = { alias }
// https://vitejs.dev/config/
export default defineConfig({
plugins,
resolve,
test: {
// root: "src",
globals: true,
environment: 'jsdom',
testTimeout: 2000,
setupFiles: pathResolve(__dirname, 'vitest-setup.ts'),
include: ['**/*.test.tsx', '**/*.test.ts'],
// coverage: {
// enabled: true,
// },
},
})