// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0 import { fileURLToPath } from "node:url" import { defineConfig } from "vitest/config" const source = (path: string): string => fileURLToPath(new URL(path, import.meta.url)) export default defineConfig({ // The web shell's tsconfig says `jsx: preserve` (Next compiles it); a test that renders one of its // components compiles the JSX itself, with React's automatic runtime. oxc: { jsx: { runtime: "automatic" } }, // The workspace's own packages resolve to their source here, as they do for `tsc` (the `paths` // of tsconfig.paths.json): a test run then needs no build step, and what it checks is the file // the author edited. resolve: { alias: [ { find: /^@app\/config$/, replacement: source("./config/src/index.ts") }, { find: /^@app\/modules$/, replacement: source("./modules/index.ts") }, { find: /^@app\/modules\/(.*)$/, replacement: source("./modules/$1") }, ], }, test: { // The app's own checks (test/) and every module's unit tests. A module's adapter contract // tests need a database and run from the module's own gate, not from this one. // `evals/` holds the offline evaluations, with thresholds, that gate a change of a prompt or a schema. include: ["test/**/*.test.ts", "modules/**/__tests__/**/*.test.{ts,tsx}", "evals/**/*.test.ts"], environment: "node", // The isolation suite runs every tenant-scoped procedure twice; the default 5s is not enough // on a cold start, and a flake here would be read as a tenancy failure. testTimeout: 60_000, restoreMocks: true, }, })