Highlights: - Streaming chat chunks + web search auto (Sherlock/SearXNG) - pino structured logging (43->0 console.log) - Zod validation (19 schemas API + storage) - Qwen3-TTS 0.6B + 33 persona voices - Docling + bge-reranker RAG pipeline - React lazy routes (-50% bundle), virtualized chat - SEC-01->05 all resolved - A11y WCAG (40 ARIA attrs) - Perf + error telemetry endpoints - Systemd units (TTS, LightRAG, reranker) - p-limit Ollama, WS reconnect, signal handlers - createId thread-safe via crypto.randomBytes (lot-59) - Hyperparam bounds validation with Zod schema (lot-60) - DPO extractDPOPairs warns on empty pairs (lot-61) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
83 lines
2.3 KiB
JavaScript
83 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
// Runs all V2 package tests using node --test
|
|
// First compiles TypeScript, then runs the compiled test files
|
|
|
|
const path = require("path");
|
|
const { execFileSync } = require("child_process");
|
|
|
|
const ROOT_DIR = path.resolve(__dirname, "..");
|
|
const TSC_BIN = require.resolve("typescript/bin/tsc");
|
|
|
|
const PACKAGES = [
|
|
"core",
|
|
"auth",
|
|
"chat-domain",
|
|
"persona-domain",
|
|
"node-engine",
|
|
"storage",
|
|
"tui",
|
|
"ui",
|
|
];
|
|
|
|
function main() {
|
|
// Step 1: Compile all V2 packages (including test files)
|
|
console.log("[test:v2] Compiling TypeScript...");
|
|
try {
|
|
execFileSync(process.execPath, [TSC_BIN, "-b", "tsconfig.v2.json", "--pretty", "false"], {
|
|
cwd: ROOT_DIR,
|
|
stdio: "pipe",
|
|
});
|
|
} catch (err) {
|
|
const output = (err.stdout || "").toString() + (err.stderr || "").toString();
|
|
console.error("[test:v2] TypeScript compilation failed:");
|
|
console.error(output);
|
|
process.exit(1);
|
|
}
|
|
console.log("[test:v2] Compilation OK");
|
|
|
|
// Step 2: Collect all compiled test files (supports split test suites)
|
|
const fs = require("fs");
|
|
const testFiles = [];
|
|
for (const pkg of PACKAGES) {
|
|
const distDir = path.join(ROOT_DIR, "packages", pkg, "dist");
|
|
try {
|
|
const files = fs.readdirSync(distDir);
|
|
const tests = files.filter((f) => f.endsWith(".test.js")).map((f) => path.join(distDir, f));
|
|
if (tests.length === 0) {
|
|
console.warn(`[test:v2] Warning: no compiled test files for ${pkg}`);
|
|
}
|
|
testFiles.push(...tests);
|
|
} catch {
|
|
console.warn(`[test:v2] Warning: no dist dir for ${pkg}`);
|
|
}
|
|
}
|
|
|
|
// Also collect API test files
|
|
const apiDistDir = path.join(ROOT_DIR, "apps", "api", "dist");
|
|
try {
|
|
const files = fs.readdirSync(apiDistDir);
|
|
const apiTests = files.filter(f => f.endsWith(".test.js")).map(f => path.join(apiDistDir, f));
|
|
testFiles.push(...apiTests);
|
|
} catch {}
|
|
|
|
if (testFiles.length === 0) {
|
|
console.error("[test:v2] No test files found");
|
|
process.exit(1);
|
|
}
|
|
|
|
// Step 3: Run tests with node --test
|
|
console.log(`[test:v2] Running ${testFiles.length} test files...`);
|
|
try {
|
|
execFileSync(process.execPath, ["--experimental-test-module-mocks", "--test", ...testFiles], {
|
|
cwd: ROOT_DIR,
|
|
stdio: "inherit",
|
|
});
|
|
} catch (err) {
|
|
process.exit(err.status || 1);
|
|
}
|
|
|
|
console.log("[test:v2] All tests passed");
|
|
}
|
|
|
|
main();
|