Skip to content

marmotte / vitest/tmpdir

vitest/tmpdir

Functions

createTmpDir()

createTmpDir(): Promise<string>

Defined in: src/vitest/tmpdir.ts:12

Asynchronously creates a unique temporary directory and returns its absolute path.

Returns

Promise<string>


createTmpDirSync()

createTmpDirSync(): string

Defined in: src/vitest/tmpdir.ts:7

Synchronously creates a unique temporary directory and returns its absolute path.

Returns

string


withTmpDir()

withTmpDir(): object

Defined in: src/vitest/tmpdir.ts:24

Sets up beforeAll and afterAll hooks to create a tmp dir

the dir will be deleted at the end of test context (see https://vitest.dev/api/#afterall)

Returns

object

a reference to the dir. It must only be accessed inside tests or subsequent beforeAll hooks

Note that beforeAll hooks are run sequentially (see https://github.com/vitest-dev/vitest/issues/2279)

path
Get Signature

get path(): string

Returns

string