test/esm/test-runner.js
raw| 1 | import chalk from "chalk"; |
| 2 | |
| 3 | export default async function testRunner({ title, testcases }) { |
| 4 | console.log(title); |
| 5 | const indent = " "; |
| 6 | for (const [subtitle, testcase] of testcases) { |
| 7 | try { |
| 8 | await testcase(); |
| 9 | console.log(chalk.green(indent + "✓ " + subtitle)); |
| 10 | } catch (e) { |
| 11 | console.log(chalk.red(indent + "✗ " + subtitle)); |
| 12 | console.error(e); |
| 13 | process.exitCode = 1; |
| 14 | } |
| 15 | } |
| 16 | } |