| 216 | |
| 217 | const results = []; |
| 218 | |
| 219 | function sequence(name, fn, sandbox) { |
| 220 | const start = Date.now(); |
| 221 | let passed = false; |
| 222 | let detail = ''; |
| 223 | try { |
| 224 | const r = fn(sandbox); |
| 225 | passed = r === true || r === undefined; |
| 226 | if (typeof r === 'string') { passed = false; detail = r; } |
| 227 | } catch (e) { |
| 228 | detail = e.message; |
| 229 | } |
| 230 | const ms = Date.now() - start; |
| 231 | results.push({ name, passed, detail, ms }); |
| 232 | const icon = passed ? 'PASS' : 'FAIL'; |
| 233 | const suffix = detail ? `\n ${detail}` : ''; |
| 234 | console.log(` ${icon} ${name}${suffix}`); |
| 235 | } |
| 236 | |
| 237 | // ── Sequences ───────────────────────────────────────────────────────────────── |