(dir: string, output = {})
| 93 | } |
| 94 | |
| 95 | export async function fsToJson(dir: string, output = {}) { |
| 96 | const files = await fs.readdir(dir).catch((e: Error) => e) |
| 97 | if (!Array.isArray(files)) { |
| 98 | return output |
| 99 | } |
| 100 | for (let file of files) { |
| 101 | const fsPath = join(dir, file) |
| 102 | const stat = await fs.stat(fsPath) |
| 103 | if (stat.isDirectory()) { |
| 104 | output[file] = {} |
| 105 | await fsToJson(fsPath, output[file]) |
| 106 | } else { |
| 107 | output[file] = stat.mtime.toISOString() |
| 108 | } |
| 109 | } |
| 110 | return output |
| 111 | } |
| 112 | |
| 113 | export async function expectWidth(res, w, { expectAnimated = false } = {}) { |
| 114 | const buffer = await res.buffer() |
no test coverage detected