diff --git a/src/deps.test.ts b/src/deps.test.ts index 9c48a79..9530214 100644 --- a/src/deps.test.ts +++ b/src/deps.test.ts @@ -17,19 +17,8 @@ export { isNode } from "https://deno.land/x/which_runtime@0.2.0/mod.ts"; * then cleans up and restores the cwd when complete. */ export async function withTempDir(action: (path: PathRef) => Promise | void) { - const originalDirPath = Deno.cwd(); - const dirPath = await Deno.makeTempDir(); - Deno.chdir(dirPath); - try { - await action(createPathRef(dirPath).resolve()); - } finally { - try { - await Deno.remove(dirPath, { recursive: true }); - } catch { - // ignore - } - Deno.chdir(originalDirPath); - } + await using dirPath = usingTempDir(); + await action(createPathRef(dirPath).resolve()); } export function usingTempDir(): PathRef & AsyncDisposable { diff --git a/src/request.test.ts b/src/request.test.ts index c07f1aa..cb62f88 100644 --- a/src/request.test.ts +++ b/src/request.test.ts @@ -283,7 +283,7 @@ Deno.test("$.request", (t) => { step("ensure times out waiting for body", async () => { const request = new RequestBuilder() .url(new URL("/sleep-body/10000", serverUrl)) - .timeout(100) + .timeout(200) // so high because CI was slow .showProgress(); const response = await request.fetch(); let caughtErr: TimeoutError | undefined; @@ -297,7 +297,7 @@ Deno.test("$.request", (t) => { // DOMException instead, but not sure assert(caughtErr != null); } else { - assertEquals(caughtErr!, new TimeoutError("Request timed out after 100 milliseconds.")); + assertEquals(caughtErr!, new TimeoutError("Request timed out after 200 milliseconds.")); assert(caughtErr!.stack!.includes("request.test.ts")); // current file } });