Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/fresh/src/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,15 @@ export async function withTmpDir(
return {
dir,
async [Symbol.asyncDispose]() {
// Skip pointless cleanup in CI, speed up tests
if (Deno.env.get("CI") === "true") return;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions (and most other CI tools) sets this to true when run.

https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables


try {
await Deno.remove(dir, { recursive: true });
} catch {
// Ignore errors Files in tmp will be cleaned up by the OS
// Temp files are not cleaned up automatically on Windows
// deno-lint-ignore no-console
console.warn(`Failed to clean up temp dir: "${dir}"`);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be helpful when running locally, because if failing to remove the dirs it may spam the <user>\AppData\Local\Temp dir with new folders on WIndows that are not cleaned up if running consecutive tests.

}
},
};
Expand Down
Loading