UNPKG

@noves/noves-sdk

Version:
67 lines (59 loc) 1.73 kB
/** * Release Test Helpers * Shared utilities for the 1.5.0 release validation scripts. */ let passCount = 0; let failCount = 0; let skipCount = 0; const failures: string[] = []; export function pass(testName: string, detail?: string) { passCount++; const msg = detail ? `${testName}${detail}` : testName; console.log(` ✅ PASS: ${msg}`); } export function fail(testName: string, error: unknown) { failCount++; const errMsg = error instanceof Error ? error.message : String(error); failures.push(`${testName}: ${errMsg}`); console.log(` ❌ FAIL: ${testName}${errMsg}`); } export function skip(testName: string, reason: string) { skipCount++; console.log(` ⏭️ SKIP: ${testName}${reason}`); } export function section(name: string) { console.log(`\n${"=".repeat(60)}`); console.log(` ${name}`); console.log(`${"=".repeat(60)}`); } export function summary() { console.log(`\n${"=".repeat(60)}`); console.log(` RELEASE TEST SUMMARY`); console.log(`${"=".repeat(60)}`); console.log(` Total: ${passCount + failCount + skipCount}`); console.log(` Passed: ${passCount}`); console.log(` Failed: ${failCount}`); console.log(` Skipped: ${skipCount}`); if (failures.length > 0) { console.log(`\n FAILURES:`); failures.forEach((f, i) => console.log(` ${i + 1}. ${f}`)); } console.log(`${"=".repeat(60)}\n`); return failCount; } /** * Run an async test and catch errors gracefully. * Returns true if passed, false if failed. */ export async function runTest( testName: string, fn: () => Promise<void> ): Promise<boolean> { try { await fn(); return true; } catch (err) { fail(testName, err); return false; } }