(name: string, fn: () => Promise<string | void>)
| 392 | } |
| 393 | |
| 394 | async function runTest(name: string, fn: () => Promise<string | void>): Promise<boolean> { |
| 395 | process.stdout.write(` ${name} ... `); |
| 396 | try { |
| 397 | const detail = await fn(); |
| 398 | if (detail) process.stdout.write(`${detail} `); |
| 399 | console.log("PASS"); |
| 400 | results.push({ name, status: "PASS" }); |
| 401 | return true; |
| 402 | } catch (err) { |
| 403 | const message = err instanceof Error ? err.message : String(err); |
| 404 | console.log("FAIL"); |
| 405 | console.error(` ${message}`); |
| 406 | results.push({ name, status: "FAIL", error: message }); |
| 407 | return false; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | function skipTest(name: string, reason: string): void { |
| 412 | console.log(` ${name} ... SKIP (${reason})`); |
no outgoing calls
no test coverage detected