Move temp test dirs under a tests sub-directory

This is to match the other tests that create temp directories. It also
lets you clean up test temp directories all at once separately from
other non-test temporary directories.
This commit is contained in:
Asher 2021-05-05 11:03:04 -05:00
parent 52cf2fcf29
commit 1789cd1bcb
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -20,8 +20,8 @@ export const loggerModule = {
* These directories are placed under a single temporary code-server directory. * These directories are placed under a single temporary code-server directory.
*/ */
export async function tmpdir(testName: string): Promise<string> { export async function tmpdir(testName: string): Promise<string> {
const dir = path.join(os.tmpdir(), "code-server") const dir = path.join(os.tmpdir(), "code-server/tests")
await fs.promises.mkdir(dir, { recursive: true }) await fs.promises.mkdir(dir, { recursive: true })
return await fs.promises.mkdtemp(path.join(dir, `test-${testName}-`), { encoding: "utf8" }) return await fs.promises.mkdtemp(path.join(dir, `${testName}-`), { encoding: "utf8" })
} }