diff --git a/lib/suite.js b/lib/suite.js index 986fcf4..796d55c 100644 --- a/lib/suite.js +++ b/lib/suite.js @@ -1,9 +1,11 @@ import { readdir } from 'node:fs/promises' import { join } from 'node:path' -const walkDir = async function* (dir) { +const walkDir = async function* (dir = '.', ignores = []) { const files = await readdir(dir, { withFileTypes: true }) for (const file of files) { + if (ignores.includes(file.name)) continue + if (file.isDirectory()) { yield* walkDir(join(dir, file.name)) } else { @@ -34,9 +36,7 @@ const suite = async (folder = '.') => { const total = totalreporter() - for await (const file of walkDir(folder)) { - if (file.includes('node_modules')) continue - if (file.startsWith('.git')) continue + for await (const file of walkDir(folder, ['node_modules', '.git'])) { if (!file.endsWith('.test.js')) continue const module = join(absolutePath, file)