Skip to content

TemporaryVault.dispose method

TemporaryVault › dispose

Unregisters the vault from Obsidian and, when this handle owns the directory, deletes it.

The directory is removed only when this instance created it, or when TemporaryVaultConstructorOptions.shouldRemoveDirectoryOnDispose said so explicitly. That is what makes a handle over a directory somebody else owns — the run's shared setup vault, say, which getTemporaryVault() wraps — safe to dispose from a consumer's afterAll.

It never CREATES a transport to unregister through. A vault can only be registered in a transport that exists, so with no explicit one it uses the transport TemporaryVault.register resolved, else the worker's cached one, and skips the unregister when there is neither. Resolving the ambient transport here used to provision a whole new one for a vault whose registration had failed: on Android an Appium start and an emulator boot inside afterAll, which ran out the hook's timeout and left the emulator it was booting for the next suite to collide with.

Signature:

dispose(transportOverride?: ObsidianTransport | undefined): Promise<void>

Parameters:

ParameterTypeDescription
transportOverride?ObsidianTransport | undefinedAn explicit transport to use when unregistering. When omitted, the transport register used, else the worker's cached one, else none.

Returns: Promise<void>