Tiny, but fully loaded test-runner.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

12 lines
377 B

'use strict';
const { pass, fail } = require('./constants');
const runTests = tests => Promise.all(tests.map(each => {
const pred = each.test();
return (Array.isArray(pred) ? Promise.all(pred) : pred)
.then(() => ({ description: each.description, result: pass }))
.catch(e => ({ description: each.description, result: fail, error: e }));
}));
module.exports = runTests;