forked from StellerCraft/craft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
63 lines (62 loc) · 2.22 KB
/
Copy pathvitest.config.ts
File metadata and controls
63 lines (62 loc) · 2.22 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 { defineConfig } from 'vitest/config';
import { resolve } from 'path';
export default defineConfig({
esbuild: {
// Skip tsconfig extends resolution issues in the monorepo
tsconfigRaw: {
compilerOptions: {
target: 'ES2020',
module: 'ESNext',
moduleResolution: 'bundler',
resolveJsonModule: true,
allowJs: true,
strict: true,
esModuleInterop: true,
skipLibCheck: true,
jsx: 'preserve',
paths: {
'@/*': ['./apps/frontend/src/*'],
'@craft/types': ['./packages/types/src'],
},
},
},
},
resolve: {
alias: {
'@': resolve(__dirname, 'apps/frontend/src'),
'@craft/types': resolve(__dirname, 'packages/types/src'),
},
},
test: {
globals: true,
environment: 'node',
env: {
ARTIFACT_SIGNING_SECRET: 'test-artifact-signing-secret-32b!!',
},
// Shard safety: tests must not share mutable module-level state.
// Each worker receives an isolated module graph, so top-level vi.mock()
// and beforeEach resets are sufficient. Do not use global singletons
// that persist across describe blocks without a beforeEach reset.
//
// Sharding is configured via CLI: --shard=<index>/<total>
// Example (4 shards):
// vitest run --shard=1/4
// vitest run --shard=2/4
// vitest run --shard=3/4
// vitest run --shard=4/4
//
// The CI matrix in .github/workflows/test-sharding.yml orchestrates
// these in parallel. Shard count is set to 4 — balancing worker
// spin-up cost against suite size. Revisit when the suite grows past
// ~30 s per shard.
sequence: {
// Deterministic file order within each shard prevents flaky results
// caused by import-order side effects when only a slice is executed.
shuffle: false,
},
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
},
},
});