rethink vault opening
Some checks failed
Playwright Tests / test (push) Failing after 2m21s

This commit is contained in:
parent 76e14fe125
commit e59bdd6af3
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -73,6 +73,9 @@ function generateVaultConfig(vault: string) {
}; };
writeFileSync(obsidianConfigFile, JSON.stringify(json)); writeFileSync(obsidianConfigFile, JSON.stringify(json));
writeFileSync(path.join(configLocation, `${vaultHash}.json`), "{}"); writeFileSync(path.join(configLocation, `${vaultHash}.json`), "{}");
return vaultHash;
} else {
return "";
} }
} }
@ -81,10 +84,18 @@ const obsidianTestFixtures: Fixtures<ObsidianTestFixtures> = {
async ({ obsidian: { vault } }, run) => { async ({ obsidian: { vault } }, run) => {
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true"; process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true";
console.log("asar located at:", getExe()); 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({ const electronApp = await electron.launch({
timeout: 60000, timeout: 60000,
args: [getExe()].filter((a) => !!a) as string[], args: [getExe(), uriArg].filter((a) => !!a) as string[],
}); });
electronApp.on("console", async (msg) => { electronApp.on("console", async (msg) => {
console.log( console.log(