Skip to content

Commit

Permalink
Maybe fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Feb 4, 2024
1 parent 64a3b6a commit dfe95b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 2 additions & 13 deletions src/deps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,8 @@ export { isNode } from "https://deno.land/x/[email protected]/mod.ts";
* then cleans up and restores the cwd when complete.
*/
export async function withTempDir(action: (path: PathRef) => Promise<void> | 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 {
Expand Down
4 changes: 2 additions & 2 deletions src/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
});
Expand Down

0 comments on commit dfe95b5

Please sign in to comment.