-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
61 lines (59 loc) · 2.24 KB
/
Copy pathvitest.config.ts
File metadata and controls
61 lines (59 loc) · 2.24 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
import { defineConfig } from "vitest/config";
import * as fs from "node:fs";
import * as path from "node:path";
// Load .env from repo root so local test configuration is available
const envPath = path.resolve(import.meta.dirname, ".env");
if (fs.existsSync(envPath)) {
for (const line of fs.readFileSync(envPath, "utf-8").split("\n")) {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith("#")) continue;
const eq = trimmed.indexOf("=");
if (eq === -1) continue;
const key = trimmed.slice(0, eq);
const val = trimmed.slice(eq + 1);
if (!process.env[key]) process.env[key] = val;
}
}
export default defineConfig({
// Resolve workspace deps via the `@roomy-ai/dev` export condition so Vite
// pulls TS source from each package's src/ directly. Without this it
// walks the default `import` condition (e.g. @roomy-ai/shared/dist/index.js),
// which only exists after a separate `tsc` build of every package —
// fine locally for anyone who has built once, broken on fresh CI
// checkouts where `npm ci` does not run package build scripts. The
// `ssr.resolve.externalConditions` key is the one that matters for
// workspace-as-node_modules deps under vitest's SSR loader.
resolve: {
alias: {
// Mirror the `@/` path alias from packages/app/vite.config.ts
// so that app unit tests (e.g. store/ws/middleware.test.ts) can
// import from `@/store/…`, `@/auth/…`, etc.
"@": path.resolve(import.meta.dirname, "packages/app/src"),
},
conditions: ["@roomy-ai/dev"],
},
ssr: {
resolve: {
conditions: ["@roomy-ai/dev"],
externalConditions: ["@roomy-ai/dev"],
},
},
test: {
// Suppress node:sqlite's "experimental feature" warning — it's a known
// limitation of Node 23; the module is stable enough for production use.
env: { NODE_OPTIONS: "--no-warnings" },
exclude: [
"**/node_modules/**",
"**/dist/**",
"**/test/e2e/**",
"packages/app/e2e/**",
".worktrees/**",
".claude/**",
],
testTimeout: 30_000,
hookTimeout: 30_000,
// Serialize file execution: scheduler integration tests share system-level
// state (atq, crontab) and race when run in parallel workers.
fileParallelism: false,
},
});