diff options
Diffstat (limited to 'tests/driver.js')
-rw-r--r-- | tests/driver.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/driver.js b/tests/driver.js index d273c5d..d3c1f7b 100644 --- a/tests/driver.js +++ b/tests/driver.js @@ -1,9 +1,8 @@ -const isAsync = f => - typeof f.then === 'function' && - f[Symbol.toStringTag] === 'Promise'; - -const t = ({ colors, err, assert }) => ({ - assert, +const t = ({ colors, err, assert: { equal, deepEqual }}) => ({ + assert: { + equal, + deepEqual, + }, tap: x => { err(`tap: ${x}\n`); return x; @@ -14,11 +13,7 @@ const t = ({ colors, err, assert }) => ({ test: async (msg, fn) => { err(`${colors.yellow("testing")}: ${msg}... `); try { - if (isAsync(fn)) { - await fn(); - } else { - fn(); - } + await fn(); } catch (e) { err(`${colors.red("ERR")}.\n`); throw e; @@ -28,7 +23,8 @@ const t = ({ colors, err, assert }) => ({ }); export const runTests = async (conf, tests) => { + const tFinal = t(conf); for (const testFn of tests) { - await testFn(t(conf)); + await testFn(tFinal); } }; |