MCPcopy Create free account
hub / github.com/babel/babel / readdirRecursive

Function readdirRecursive

scripts/parser-tests/flow/index.js:58–75  ·  view source on GitHub ↗
(root, dir = ".")

Source from the content-addressed store, hash-verified

56}
57
58async 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
77async function* loadTests(root) {
78 for await (const file of readdirRecursive(root)) {

Callers 1

loadTestsFunction · 0.85

Calls 2

mergeFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected