22 lines
459 B
JavaScript
Executable file
22 lines
459 B
JavaScript
Executable file
#!/usr/bin/env node
|
|
|
|
import * as Tests from './units/index.js'
|
|
|
|
const ap = f => f()
|
|
const fmt = ({ success, description, error }) => {
|
|
if (success) {
|
|
return `${description}: PASS`
|
|
} else {
|
|
return `${description}: FAIL\n${error.stack}`
|
|
}
|
|
}
|
|
|
|
const results = Object.entries(Tests).map(([name, tests]) => ({
|
|
name,
|
|
tests: tests.map(ap).map(fmt).join('\n')
|
|
}))
|
|
.map(({ name, tests }) => `${name}\n${tests}`)
|
|
.join('\n')
|
|
|
|
console.log(results)
|
|
|