forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

vitest.contract.config.ts37 lines, 1.4 KiBHistoryRawDownload
1import path from "node:path";
2import { defineConfig } from "vitest/config";
3
4/**
5 * Contract suite — runs against a REAL backend, never mocked fetch.
6 * Excluded from `bun run test` (see `exclude` in vitest.config.ts).
7 *
8 * Boot a throwaway backend (do not point this at the container on :8080):
9 * ~/.surrealdb/surreal start --user root --pass root --bind 127.0.0.1:8100 memory
10 * cd <your hezarfen_backend checkout> && PORT=8081 DB_URL=ws://127.0.0.1:8100 \
11 * DB_USER=root DB_PASS=root ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123 cargo run
12 * Then:
13 * CONTRACT_BASE_URL=http://127.0.0.1:8081 bun run test:contract
14 *
15 * The backend repo is private and not cloned next to this one by default —
16 * clone it anywhere, the path above is a placeholder.
17 *
18 * Without CONTRACT_BASE_URL the whole suite skips (green, not failed).
19 * Optional: ADMIN_USERNAME / ADMIN_PASSWORD (default admin / admin123).
20 */
21export default defineConfig({
22 resolve: {
23 alias: {
24 "@": path.resolve(__dirname, "./src"),
25 },
26 },
27 test: {
28 globals: true,
29 environment: "node",
30 include: ["src/api/__tests__/contract/**/*.contract.test.ts"],
31 // The scratch backend rate-limits all requests from its loopback client.
32 // Running files serially keeps a contract run deterministic and realistic.
33 fileParallelism: false,
34 testTimeout: 30_000,
35 hookTimeout: 30_000,
36 },
37});