(options)
| 122 | } |
| 123 | |
| 124 | export async function ensureObsidianInstance(options) { |
| 125 | const provisionResult = await provisionVault(options); |
| 126 | const profileResult = await prepareObsidianProfile(options); |
| 127 | options.userDataPath = profileResult.userDataPath; |
| 128 | |
| 129 | // Assert the Obsidian app-code version BEFORE launching or reusing an instance: |
| 130 | // a build below minAppVersion makes every "missing API" e2e failure a false |
| 131 | // signal, so abort with a clear version error instead of spawning (or trusting |
| 132 | // a reused) sub-minimum instance. Stderr keeps the note off command stdout. |
| 133 | const compatibility = await assertObsidianMeetsMinAppVersion(options); |
| 134 | console.error( |
| 135 | `Obsidian app ${compatibility.appVersion}` + |
| 136 | `${compatibility.installerVersion ? ` (installer ${compatibility.installerVersion})` : ""}` + |
| 137 | `, plugin minAppVersion ${compatibility.minAppVersion}`, |
| 138 | ); |
| 139 | |
| 140 | if (!(await isInstanceReady(options))) { |
| 141 | await launchObsidianInstance(options); |
| 142 | await waitForInstanceReady(options); |
| 143 | } |
| 144 | |
| 145 | await trustVaultAndVerifyQuickAdd(options); |
| 146 | |
| 147 | return { |
| 148 | ...provisionResult, |
| 149 | ...profileResult, |
| 150 | obsidianHome: options.obsidianHome, |
| 151 | }; |
| 152 | } |
| 153 | |
| 154 | function spawnObsidian(options, commandArgs) { |
| 155 | return new Promise((resolve) => { |
no test coverage detected