Skip to content

withAppConfig<T>

Runs work with a vault config key temporarily set, and puts the key back afterwards — on a throw as much as on a return.

The shape a popout-subject test wants:

await withAppConfig({
async callback() {
await evalInObsidian({ ... }); // the settings window is a popout in here
},
configKey: 'settingsPopoutWindow',
value: true,
vaultPath
});

The callback runs on the Node side, so it is free to make several evals, take a screenshot, or assert between them.

Import:

import { withAppConfig } from 'obsidian-integration-testing';

Signature:

function withAppConfig(params: WithAppConfigParams<T>): Promise<T>

Parameters:

ParameterTypeDescription
paramsWithAppConfigParams<T>The key, the value to hold it at, the work, and transport / vault overrides.

Returns: Promise<T> — A Promise resolving to whatever the callback returned.


Links to this page: