-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
74 lines (72 loc) · 2.74 KB
/
Copy pathvitest.config.ts
File metadata and controls
74 lines (72 loc) · 2.74 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
64
65
66
67
68
69
70
71
72
73
74
import { defineConfig } from 'vitest/config';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
const shared = {
env: {
GIT_AUTHOR_NAME: 'patchlab-test',
GIT_AUTHOR_EMAIL: 'test@patchlab.local',
GIT_COMMITTER_NAME: 'patchlab-test',
GIT_COMMITTER_EMAIL: 'test@patchlab.local',
},
testTimeout: 120_000,
hookTimeout: 60_000,
} as const;
export default defineConfig({
// Keep Vite's transform cache outside node_modules to prevent stale
// cache errors on Windows ("Cannot read properties of undefined
// (reading 'config')") that occur when the cache is invalidated by
// code changes or npm operations.
cacheDir: join(tmpdir(), 'patchlab-vitest-cache'),
// Disable the dependency optimizer — its mid-run stale checks can
// cause "Cannot read properties of undefined (reading 'config')"
// crashes on Windows, especially during heavy integration tests.
optimizeDeps: { disabled: true },
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
},
projects: [
{
test: {
name: 'unit',
include: ['test/unit/**/*.test.ts'],
...shared,
},
},
{
test: {
name: 'integration',
include: ['test/integration/**/*.test.ts'],
setupFiles: ['test/integration/setup-podman.ts'],
fileParallelism: false,
...shared,
},
},
{
// POSIX-only assertions (fifo/socket types, case-sensitive
// `.YAML` vs `.yaml`, unprivileged symlinks). Run with
// `npm run test:posix`, which executes this project inside
// a Linux container. NOT included in the default `npm test`
// run because it's a no-op on Windows hosts.
test: {
name: 'posix',
include: ['test/posix/**/*.test.ts'],
...shared,
},
},
{
// Windows-only assertions (NTFS junctions / reparse points,
// drive-letter handling, separator-mixing on Windows-shaped
// paths). Each test self-gates with `process.platform !==
// 'win32'` so the project is a no-op on POSIX hosts. Run via
// `npm test` on a Windows host; runs inert on Linux/macOS.
test: {
name: 'windows',
include: ['test/windows/**/*.test.ts'],
...shared,
},
},
],
},
});