import path from 'node:path' import { walkDir } from './walkDir.js' import { summaryreporter, totalreporter, totalerrorreporter } from 'metaltest' const suite = async (folder = '.') => { const fileIgnored = [] const total = totalreporter() const error = totalerrorreporter() for await (const file of walkDir(folder, ['node_modules', '.git'])) { if (!file.endsWith('.test.js')) continue const module = path.resolve(folder, file) const { test } = await import(module) if (test === undefined) { fileIgnored.push(file) continue } await test.run(summaryreporter(), error, total) } for (const file of fileIgnored) { console.log(`The file ${file} doesn't export the metaltest object`) } error.msg() console.log(total.msg()) } export { suite }