mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-26 08:56:40 -05:00
22 lines
397 B
TypeScript
22 lines
397 B
TypeScript
import { vol } from "memfs";
|
|
import { test } from "vitest";
|
|
|
|
export const testWithTmpDir = test.extend<{
|
|
tmp: string;
|
|
}>({
|
|
tmp: async ({}, use) => {
|
|
const tmpDir = "/tmp";
|
|
vol.reset();
|
|
const tmp = vol.mkdirSync(tmpDir, { recursive: true });
|
|
if (!tmp) {
|
|
throw new Error("Failed to create temporary directory");
|
|
}
|
|
|
|
try {
|
|
await use(tmp);
|
|
} finally {
|
|
vol.reset();
|
|
}
|
|
},
|
|
});
|