-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
vitest.config.mts
52 lines (48 loc) · 1.26 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
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
const dir = dirname(fileURLToPath(import.meta.url))
function noop() {}
const provider = process.env.PROVIDER || 'playwright'
const browser = process.env.BROWSER || (provider === 'playwright' ? 'chromium' : 'chrome')
export default defineConfig({
server: {
headers: {
'x-custom': 'hello',
},
},
optimizeDeps: {
include: ['@vitest/cjs-lib'],
},
test: {
include: ['test/**.test.{ts,js}'],
// having a snapshot environment doesn't affect browser tests
snapshotEnvironment: './custom-snapshot-env.ts',
browser: {
enabled: true,
name: browser,
headless: false,
provider,
isolate: false,
slowHijackESM: true,
},
alias: {
'#src': resolve(dir, './src'),
},
open: false,
diff: './custom-diff-config.ts',
outputFile: './browser.json',
reporters: ['json', {
onInit: noop,
onPathsCollected: noop,
onCollected: noop,
onFinished: noop,
onTaskUpdate: noop,
onTestRemoved: noop,
onWatcherStart: noop,
onWatcherRerun: noop,
onServerRestart: noop,
onUserConsoleLog: noop,
}, 'default'],
},
})