You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
492 B

import { mkdirSync, rmSync } from "node:fs"
import { tmpdir } from "node:os"
import { join } from "node:path"
export default function testTmpDir(): string {
const testName = (expect.getState().currentTestName ?? "unknown")
.toLowerCase()
.replace(/[^a-z0-9]/gi, "_")
.replace(/_+/g, "_")
const tmpDir = join(tmpdir(), `shellcode/${testName}`)
mkdirSync(tmpDir, { recursive: true })
rmSync(join(tmpDir, "fnm/aliases"), { recursive: true, force: true })
return tmpDir
}