Ignore test file with no metaltest exported

master
Frédéric Matte 2022-12-04 16:45:57 -05:00
parent 42fb4ab2c0
commit 036f7a0563
1 changed files with 11 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import { consolereporter, totalreporter } from 'metaltest'
const suite = async (folder = '.') => { const suite = async (folder = '.') => {
const absolutePaths = getStackAbsolutePaths() const absolutePaths = getStackAbsolutePaths()
const absolutePath = absolutePaths[2] const absolutePath = absolutePaths[2]
const fileIgnored = []
const total = totalreporter() const total = totalreporter()
@ -40,9 +41,19 @@ const suite = async (folder = '.') => {
const module = join(absolutePath, file) const module = join(absolutePath, file)
const { test } = await import(module) const { test } = await import(module)
if (test === undefined) {
fileIgnored.push(file)
continue
}
await test.run(consolereporter(), total) await test.run(consolereporter(), total)
} }
for (const file of fileIgnored) {
console.log(`The file ${file} doesn't export the metaltest object`)
}
console.log(total.msg()) console.log(total.msg())
} }