-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathreport.ts
More file actions
48 lines (42 loc) · 1.46 KB
/
report.ts
File metadata and controls
48 lines (42 loc) · 1.46 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
/**
* Generate human-readable + JSON reports for the CI smoke run.
*/
import { writeFileSync, mkdirSync } from "fs";
import { dirname, join } from "path";
import type { ScenarioResult } from "../scenarios/types";
const ARTIFACTS_DIR = join(process.cwd(), "ci-artifacts");
const REPORT_FILE = join(ARTIFACTS_DIR, "ci-route-chain-report.json");
export interface RunReport {
timestamp: string;
totalScenarios: number;
passed: number;
failed: number;
aborted: boolean;
durationMs: number;
results: ScenarioResult[];
}
export function writeReport(report: RunReport): void {
mkdirSync(dirname(REPORT_FILE), { recursive: true });
writeFileSync(REPORT_FILE, JSON.stringify(report, null, 2) + "\n");
}
export function printSummary(report: RunReport): void {
console.log("\n=== CI Smoke Test Report ===");
console.log(`Timestamp: ${report.timestamp}`);
console.log(`Total: ${report.totalScenarios}`);
console.log(`Passed: ${report.passed}`);
console.log(`Failed: ${report.failed}`);
console.log(`Aborted: ${report.aborted}`);
console.log(`Duration: ${report.durationMs}ms`);
console.log("");
for (const r of report.results) {
const icon = r.passed ? "PASS" : "FAIL";
const crit = r.critical ? " [CRITICAL]" : "";
console.log(` ${icon} ${r.name}${crit} (${r.durationMs}ms) - ${r.message}`);
}
console.log("");
if (report.failed > 0) {
console.log("SMOKE TEST FAILED");
} else {
console.log("SMOKE TEST PASSED");
}
}