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.
|
|
|
import { mkdirSync } 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 })
|
|
|
|
|
|
|
|
return tmpDir
|
|
|
|
}
|