diff --git a/packages/obsidian-testing-framework/src/index.ts b/packages/obsidian-testing-framework/src/index.ts index 6408ea9..357aeb9 100644 --- a/packages/obsidian-testing-framework/src/index.ts +++ b/packages/obsidian-testing-framework/src/index.ts @@ -73,6 +73,9 @@ function generateVaultConfig(vault: string) { }; writeFileSync(obsidianConfigFile, JSON.stringify(json)); writeFileSync(path.join(configLocation, `${vaultHash}.json`), "{}"); + return vaultHash; + } else { + return ""; } } @@ -81,10 +84,18 @@ const obsidianTestFixtures: Fixtures = { async ({ obsidian: { vault } }, run) => { process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true"; console.log("asar located at:", getExe()); - if (vault) generateVaultConfig(vault); + let uriArg = ""; + if (vault) { + let id = generateVaultConfig(vault); + if(!!id) { + uriArg = `obsidian://open?vault=${encodeURIComponent(id)}` + } + } + + const electronApp = await electron.launch({ timeout: 60000, - args: [getExe()].filter((a) => !!a) as string[], + args: [getExe(), uriArg].filter((a) => !!a) as string[], }); electronApp.on("console", async (msg) => { console.log(