-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvitest.config.ts
More file actions
52 lines (48 loc) · 2.49 KB
/
vitest.config.ts
File metadata and controls
52 lines (48 loc) · 2.49 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
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
const repoRoot = fileURLToPath(new URL('.', import.meta.url))
function fromRoot(...segments: string[]) {
return path.resolve(repoRoot, ...segments)
}
// Exact-match aliases keep workspace package imports on source files without requiring dist builds.
const workspaceAliases = [
{ find: /^textura$/, replacement: fromRoot('packages/textura/src/index.ts') },
{ find: /^@geometra\/core$/, replacement: fromRoot('packages/core/src/index.ts') },
{ find: /^@geometra\/core\/node$/, replacement: fromRoot('packages/core/src/node.ts') },
{ find: /^@geometra\/renderer-canvas$/, replacement: fromRoot('packages/renderer-canvas/src/index.ts') },
{ find: /^@geometra\/renderer-terminal$/, replacement: fromRoot('packages/renderer-terminal/src/index.ts') },
{ find: /^@geometra\/renderer-webgpu$/, replacement: fromRoot('packages/renderer-webgpu/src/index.ts') },
{ find: /^@geometra\/server$/, replacement: fromRoot('packages/server/src/index.ts') },
{ find: /^@geometra\/client$/, replacement: fromRoot('packages/client/src/index.ts') },
{ find: /^@geometra\/router$/, replacement: fromRoot('packages/router/src/index.ts') },
{ find: /^@geometra\/ui$/, replacement: fromRoot('packages/ui/src/index.ts') },
{ find: /^@geometra\/gateway$/, replacement: fromRoot('packages/gateway/src/index.ts') },
]
export default defineConfig({
resolve: {
alias: workspaceAliases,
},
test: {
pool: 'threads',
// Cap parallel workers so large `vitest run` batches (e.g. `npm run release:gate`) do not exhaust
// thread pool / memory on laptops and shared CI runners — avoids spurious per-test timeouts when
// workers fail to start ("Timeout waiting for worker to respond").
maxWorkers: 8,
testTimeout: 30_000,
hookTimeout: 60_000,
setupFiles: [fromRoot('vitest.setup.ts')],
exclude: [
// Vitest's default exclude list (kept explicit so it composes with our additions).
'**/node_modules/**',
'**/dist/**',
'**/cypress/**',
'**/.{idea,git,cache,output,temp}/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',
// Playwright specs under tests/e2e live in their own runner — vitest's
// default glob (**/*.spec.ts) otherwise picks them up and throws on the
// @playwright/test import, which has bitten every fresh-checkout `vitest run`.
'tests/e2e/**',
],
},
})