MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / withTempDir

Function withTempDir

packages/node/src/__tests__/nodeAppHotReload.test.ts:27–34  ·  view source on GitHub ↗
(run: (dir: string) => Promise<T> | T)

Source from the content-addressed store, hash-verified

25type State = Readonly<{ value: number }>;
26
27async function withTempDir<T>(run: (dir: string) => Promise<T> | T): Promise<T> {
28 const dir = mkdtempSync(join(tmpdir(), "rezi-node-hsr-lifecycle-test-"));
29 try {
30 return await run(dir);
31 } finally {
32 rmSync(dir, { recursive: true, force: true });
33 }
34}
35
36function writeViewModule(root: string, label: string): string {
37 mkdirSync(root, { recursive: true });

Callers 1

Calls 1

runFunction · 0.50

Tested by

no test coverage detected