Files
Claude-Code-Monitor/client/vitest.config.ts
T
nntrivi2001 44c4244e44 feat: Claude Code Monitor — lanes, pipelines and a merged workspace
Internal SmartGift build of a Claude Code monitoring dashboard.

Lanes: a durable unit of parallel agent work, one per working directory,
tracked across session restarts. Managed lanes are git worktrees the
dashboard provisions and can reset or remove behind a three-check destroy
guard and a counted preflight; adopted lanes are directories you already
own and are never destroyable.

Pipelines: a lane moves through pipeline stages. A stage the agent declares
with evidence renders green; a stage inferred from the tool-event stream
renders dashed amber and never counts as done. Detection is forward-only
within a 30-minute window, and never writes the declared stage.

Workspace: one page at /run with a lane grid, the selected lane's pipeline,
and a full Claude console behind a disclosure.
2026-07-30 13:35:58 +07:00

40 lines
1.4 KiB
TypeScript

/**
* @file vitest.config.ts
* @description Vitest configuration for the client test suite — jsdom environment, React plugin, test globals, and the same build-time `__APP_VERSION__` injection as vite.config.ts so version-dependent components render identically under test.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
// Mirror vite.config.ts: inject the repo-root project version as `__APP_VERSION__`
// so components that render it (e.g. the sidebar footer) behave the same in tests.
// Fail-safe resolution (root -> client -> placeholder) matches vite.config.ts.
function resolveAppVersion(): string {
for (const rel of ["../package.json", "package.json"]) {
try {
const { version } = JSON.parse(readFileSync(resolve(process.cwd(), rel), "utf8"));
if (version) return version as string;
} catch {
// Not found or unreadable at this path — try the next candidate.
}
}
return "0.0.0";
}
const APP_VERSION = resolveAppVersion();
export default defineConfig({
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify(APP_VERSION),
},
test: {
environment: "jsdom",
setupFiles: ["./src/test-setup.ts"],
include: ["src/**/*.test.{ts,tsx}"],
css: false,
},
});