( options?: Deno.MakeTempOptions, )
| 138 | export const delay = (ms: number) => new Promise((r) => setTimeout(r, ms)); |
| 139 | |
| 140 | export async function withTmpDir( |
| 141 | options?: Deno.MakeTempOptions, |
| 142 | ): Promise<{ dir: string } & AsyncDisposable> { |
| 143 | const dir = await Deno.makeTempDir(options); |
| 144 | return { |
| 145 | dir, |
| 146 | async [Symbol.asyncDispose]() { |
| 147 | // Skip pointless cleanup in CI, speed up tests |
| 148 | if (Deno.env.get("CI") === "true") return; |
| 149 | |
| 150 | try { |
| 151 | await Deno.remove(dir, { recursive: true }); |
| 152 | } catch { |
| 153 | // Temp files are not cleaned up automatically on Windows |
| 154 | // deno-lint-ignore no-console |
| 155 | console.warn(`Failed to clean up temp dir: "${dir}"`); |
| 156 | } |
| 157 | }, |
| 158 | }; |
| 159 | } |
| 160 | |
| 161 | export class MockBuildCache<State> implements BuildCache<State> { |
| 162 | #files: FsRouteFile<State>[]; |
no outgoing calls
no test coverage detected