Muthu Kumar
6 years ago
2 changed files with 8 additions and 7 deletions
@ -1,11 +1,12 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
const { pass, fail } = require('../constants'); |
const { pass, fail } = require('./constants'); |
||||
|
|
||||
const runTests = tests => Promise.all(tests.map(test => |
const runTests = tests => Promise.all(tests.map(each => { |
||||
test.test() |
const pred = each.test(); |
||||
.then(() => ({ description: test.description, result: pass })) |
return (Array.isArray(pred) ? Promise.all(pred) : pred) |
||||
.catch(e => ({ description: test.description, result: fail, error: e })) |
.then(() => ({ description: each.description, result: pass })) |
||||
)); |
.catch(e => ({ description: each.description, result: fail, error: e })); |
||||
|
})); |
||||
|
|
||||
module.exports = runTests; |
module.exports = runTests; |
||||
|
Loading…
Reference in new issue