( filePath: string, fn: (text: string) => string | Promise<string>, )
| 10 | export const FIXTURE_DIR = path.join(import.meta.dirname!, "fixtures"); |
| 11 | |
| 12 | export async function updateFile( |
| 13 | filePath: string, |
| 14 | fn: (text: string) => string | Promise<string>, |
| 15 | ) { |
| 16 | const original = await Deno.readTextFile(filePath); |
| 17 | const result = await fn(original); |
| 18 | await Deno.writeTextFile(filePath, result); |
| 19 | |
| 20 | return { |
| 21 | async [Symbol.asyncDispose]() { |
| 22 | await Deno.writeTextFile(filePath, original); |
| 23 | }, |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | async function copyDir(from: string, to: string) { |
| 28 | const entries = walk(from, { |
no test coverage detected