This repository has been archived on 2023-03-15. You can view files and clone it, but cannot push or open issues or pull requests.
infrastructure/docker/netiquette/test/runner.mjs

29 lines
587 B
JavaScript
Raw Normal View History

2019-06-01 14:02:49 +00:00
'use strict'
import io from './io.mjs'
import iptables from './iptables.mjs'
(async () => {
const res = await [
...io,
...iptables
].map(async f => {
try {
await f()
return 'passed'
}
catch(e) {
console.error(e)
return 'failed'
}
}).reduce(async (acc, r) => {
const accumulator = await acc
const result = await r
accumulator.total++
accumulator[result]++
return accumulator
}, {total: 0, passed: 0, failed: 0})
console.log(`Done. passed: ${res.passed}, failed: ${res.failed}, total: ${res.total}`)
})()