diff --git a/packages/obsidian-testing-framework/src/index.ts b/packages/obsidian-testing-framework/src/index.ts index 3fe8a38..b1b7a8a 100644 --- a/packages/obsidian-testing-framework/src/index.ts +++ b/packages/obsidian-testing-framework/src/index.ts @@ -55,10 +55,13 @@ function generateVaultConfig(vault: string) { } else { configLocation = path.join(`${process.env.XDG_CONFIG_HOME}`, "obsidian"); try { - mkdirSync(configLocation, {recursive: true}) - } catch(e) {} + mkdirSync(configLocation, { recursive: true }); + } catch (e) {} } const obsidianConfigFile = path.join(configLocation, "obsidian.json"); + if (!existsSync(obsidianConfigFile)) { + writeFileSync(obsidianConfigFile, JSON.stringify({ vaults: {} })); + } const json: { vaults: { [key: string]: { @@ -90,12 +93,11 @@ const obsidianTestFixtures: Fixtures = { let uriArg = ""; if (vault) { let id = generateVaultConfig(vault); - if(!!id) { - uriArg = `obsidian://open?vault=${encodeURIComponent(id)}` + if (!!id) { + uriArg = `obsidian://open?vault=${encodeURIComponent(id)}`; } } - const electronApp = await electron.launch({ timeout: 60000, args: [getExe(), uriArg].filter((a) => !!a) as string[],