Archived
1
0

refactor: tmpdir and add to test utils

This commit is contained in:
Joe Previte
2021-04-23 14:28:39 -07:00
parent b0ecff338f
commit 7bfdd13cb3
4 changed files with 41 additions and 33 deletions

View File

@ -1,3 +1,14 @@
import * as fs from "fs"
import * as os from "os"
import * as path from "path"
export const CODE_SERVER_ADDRESS = process.env.CODE_SERVER_ADDRESS || "http://localhost:8080"
export const PASSWORD = process.env.PASSWORD || "e45432jklfdsab"
export const STORAGE = process.env.STORAGE || ""
export async function tmpdir(testName: string): Promise<string> {
const dir = path.join(os.tmpdir(), "code-server")
await fs.promises.mkdir(dir, { recursive: true })
return await fs.promises.mkdtemp(path.join(dir, `test-${testName}-`), { encoding: "utf8" })
}