babel/test/esm/test-runner.js
Karan Sapolia b63be942ce
Use native ESM for dev scripts (#12296)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-01-30 18:36:21 +01:00

16 lines
394 B
JavaScript

import chalk from "chalk";
export default async function testRunner({ title, testcases }) {
console.log(title);
const indent = " ";
for (const [subtitle, testcase] of testcases) {
try {
await testcase();
console.log(chalk.green(indent + "✓ " + subtitle));
} catch (e) {
console.log(chalk.red(indent + "✗ " + subtitle));
console.error(e);
}
}
}