-
-
Notifications
You must be signed in to change notification settings - Fork 639
/
Copy pathvitest.config.mts
44 lines (43 loc) · 1.18 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
import { existsSync } from 'node:fs'
import { resolve } from 'node:path'
import react from '@vitejs/plugin-react'
// eslint-disable-next-line import/extensions
import { defineConfig } from 'vitest/config'
export default defineConfig({
resolve: {
alias: [
{ find: /^jotai$/, replacement: resolve('./src/index.ts') },
{ find: /^jotai(.*)$/, replacement: resolve('./src/$1.ts') },
],
},
plugins: [
react({
babel: {
plugins: existsSync('./dist/babel/plugin-debug-label.js')
? [
// FIXME Can we read from ./src instead of ./dist?
'./dist/babel/plugin-debug-label.js',
]
: [],
},
}),
],
test: {
name: 'jotai',
// Keeping globals to true triggers React Testing Library's auto cleanup
// https://vitest.dev/guide/migration.html
globals: true,
environment: 'jsdom',
dir: 'tests',
reporters: 'basic',
setupFiles: ['tests/setup.ts'],
coverage: {
reporter: ['text', 'json', 'html', 'text-summary'],
reportsDirectory: './coverage/',
include: ['src/**'],
},
onConsoleLog(log) {
if (log.includes('DOMException')) return false
},
},
})