const t = ({ colors, err, assert: { equal, deepEqual }}) => ({ assert: { equal, deepEqual, }, tap: x => { err(`tap: ${x}\n`); return x; }, start: msg => { err(`${msg}:\n`); }, test: async (msg, fn) => { err(`${colors.yellow("testing")}: ${msg}... `); try { await fn(); } catch (e) { err(`${colors.red("ERR")}.\n`); throw e; } err(`${colors.green("OK")}.\n`); }, }); export const runTests = async (conf, tests) => { const tFinal = t(conf); for (const testFn of tests) { await testFn(tFinal); } };