| 56 | } |
| 57 | |
| 58 | async function* readdirRecursive(root, dir = ".") { |
| 59 | const names = await fs.readdir(path.join(root, dir)); |
| 60 | |
| 61 | const dirs = []; |
| 62 | |
| 63 | for (const name of names) { |
| 64 | const file = path.join(dir, name); |
| 65 | const stats = await fs.stat(path.join(root, file)); |
| 66 | if (!stats.isDirectory()) { |
| 67 | if (!file) continue; |
| 68 | yield file; |
| 69 | } else { |
| 70 | dirs.push(readdirRecursive(root, file)); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | yield* merge(dirs); |
| 75 | } |
| 76 | |
| 77 | async function* loadTests(root) { |
| 78 | for await (const file of readdirRecursive(root)) { |