Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

test(desktop): wait for Electron registration before bridge inspection (#776)

tianma-if816b4f67cf88
diff --git a/scripts/verify-native-release-bridge.mjs b/scripts/verify-native-release-bridge.mjs
index e05d26c8..3c8e9ac7 100644
--- a/scripts/verify-native-release-bridge.mjs
+++ b/scripts/verify-native-release-bridge.mjs
@@ -96,6 +96,15 @@ const launch = async (update) => {
});
socket.send(JSON.stringify({ id, method, params }));
});
+ // The inspector can accept connections before Electron registers its built-in
+ // module. Wait for that registration without pausing native startup.
+ await until(async () => {
+ const ready = await send("Runtime.evaluate", {
+ expression: `(() => { try { return !!process.getBuiltinModule('module').createRequire(process.resourcesPath + '/app.asar/package.json')('electron').app; } catch { return false; } })()`,
+ returnByValue: true,
+ });
+ return ready.result?.value === true;
+ }, "Electron main-process module registration");
console.log(`Configuring ${update ? "old" : "updated"} application through its isolated debugger`);
const expression = `(() => {
const req = process.getBuiltinModule('module').createRequire(process.resourcesPath + '/app.asar/package.json');