From e59bdd6af36bf224392eda47f163fc6db4a15ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Wed, 23 Oct 2024 18:07:10 -0400 Subject: [PATCH] rethink vault opening --- packages/obsidian-testing-framework/src/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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(