-
-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathvitest.config.ts
More file actions
63 lines (61 loc) · 1.91 KB
/
Copy pathvitest.config.ts
File metadata and controls
63 lines (61 loc) · 1.91 KB
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
import path from 'node:path'
import { cwd } from 'node:process'
import vue from '@vitejs/plugin-vue'
import Icons from 'unplugin-icons/vite'
import { loadEnv } from 'vite'
import { defineConfig } from 'vitest/config'
const rawIconId = '\0vitest-raw-icon'
export default defineConfig(({ mode }) => ({
plugins: [
{
name: 'vitest-raw-icon',
enforce: 'pre',
resolveId(id) {
return id.startsWith('~icons/') && id.endsWith('?raw') ? rawIconId : null
},
load(id) {
return id === rawIconId ? 'export default "<svg />"' : null
},
},
{
name: 'vitest-route-block',
enforce: 'pre',
transform(_, id) {
if (!id.includes('?vue&type=route'))
return null
return id.includes('/src/pages/ApiKeys.vue') ? 'export default { path: "/apikeys" }' : 'export default {}'
},
},
vue(),
Icons({ compiler: 'vue3' }),
],
resolve: {
alias: {
'@capgo/cli/sdk': path.resolve(cwd(), 'cli/src/sdk.ts'),
'~/': `${path.resolve(cwd(), 'src')}/`,
},
},
test: {
include: ['tests/*.test.ts'],
environment: 'node',
watch: false,
// Let the run report all failures rather than stopping at the first one.
bail: 0,
testTimeout: 30_000, // Increased from 20s to handle slow edge function responses
hookTimeout: 30_000, // Seed + edge warm under sharded CI needs headroom
retry: 0,
maxConcurrency: 2, // Keep edge-function load under Deno capacity in CI shards
// Cap workers so shards do not open too many cold isolates at once (502 from Kong).
maxWorkers: 2,
// Vitest 4: pool options are now top-level
isolate: true,
fileParallelism: true,
// Allow graceful shutdown of workers
teardownTimeout: 15_000,
// Sequence to reduce parallel load on edge functions
sequence: {
shuffle: false, // Run in predictable order
},
env: loadEnv(mode, cwd(), ''),
},
}))