MCPcopy
hub / github.com/freshframework/fresh / withTmpDir

Function withTmpDir

packages/fresh/src/test_utils.ts:140–159  ·  view source on GitHub ↗
(
  options?: Deno.MakeTempOptions,
)

Source from the content-addressed store, hash-verified

138export const delay = (ms: number) => new Promise((r) => setTimeout(r, ms));
139
140export 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
161export class MockBuildCache<State> implements BuildCache<State> {
162 #files: FsRouteFile<State>[];

Callers 4

builder_test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected