2022-03-07 21:36:22 +00:00
|
|
|
import { fileURLToPath } from 'url'
|
|
|
|
|
|
|
|
export { strict as assert } from 'assert'
|
|
|
|
|
2022-03-07 21:37:50 +00:00
|
|
|
export const pathFrom = (...args) =>
|
|
|
|
fileURLToPath(args.reduce((url, bit) => new URL(bit, url), new URL('file:')))
|
2022-03-07 21:36:22 +00:00
|
|
|
|
|
|
|
export const test = async (setup) => {
|
|
|
|
console.log(`Testing Node ${process.version}:`)
|
|
|
|
console.log('')
|
|
|
|
|
|
|
|
for (const test of setup()) {
|
|
|
|
try {
|
|
|
|
console.log(`- ${test.name}`)
|
|
|
|
|
|
|
|
await test.test()
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error)
|
|
|
|
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('')
|
|
|
|
console.log('Pass!')
|
|
|
|
console.log('')
|
|
|
|
|
|
|
|
process.exit(0)
|
|
|
|
}
|