| 98 | |
| 99 | const results = []; |
| 100 | |
| 101 | function test(name, fn) { |
| 102 | const start = Date.now(); |
| 103 | let passed = false; |
| 104 | let detail = ''; |
| 105 | try { |
| 106 | const result = fn(); |
| 107 | passed = result === true || result === undefined; |
| 108 | if (typeof result === 'string') { passed = false; detail = result; } |
| 109 | } catch (e) { |
| 110 | detail = e.message; |
| 111 | } |
| 112 | const ms = Date.now() - start; |
| 113 | results.push({ name, passed, detail, ms }); |
| 114 | const icon = passed ? 'PASS' : 'FAIL'; |
| 115 | const suffix = detail ? `\n ${detail}` : ''; |
| 116 | console.log(` ${icon} ${name}${suffix}`); |
| 117 | if (VERBOSE && detail) console.log(` ${detail}`); |
| 118 | } |
| 119 | |
| 120 | // ── Phase 1: Install verification ───────────────────────────────────────────── |