| 1274 | describe("File System Utilities", () => { |
| 1275 | describe("utils.walkDir", () => { |
| 1276 | const createTestDir = async () => { |
| 1277 | const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "walkdir-test-")) |
| 1278 | await fs.mkdir(path.join(tmpDir, "subdir1"), { recursive: true }) |
| 1279 | await fs.mkdir(path.join(tmpDir, "subdir2"), { recursive: true }) |
| 1280 | await fs.mkdir(path.join(tmpDir, "subdir1", "nested"), { recursive: true }) |
| 1281 | await fs.writeFile(path.join(tmpDir, "file1.txt"), "content1") |
| 1282 | await fs.writeFile(path.join(tmpDir, "file2.md"), "# content2") |
| 1283 | await fs.writeFile(path.join(tmpDir, "subdir1", "file3.txt"), "content3") |
| 1284 | await fs.writeFile(path.join(tmpDir, "subdir2", "file4.js"), "content4") |
| 1285 | await fs.writeFile(path.join(tmpDir, "subdir1", "nested", "file5.txt"), "content5") |
| 1286 | return tmpDir |
| 1287 | } |
| 1288 | const cleanupTestDir = async (tmpDir) => fs.rm(tmpDir, { recursive: true, force: true }) |
| 1289 | |
| 1290 | it("traverses directory structure with BFS strategy", async () => { |