mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
Investigating Electron Startup Failures
This commit is contained in:
@@ -114,7 +114,6 @@ test("ApplicationController preserves startup ordering and schedules updates aft
|
||||
events.push("prepare-runtime");
|
||||
return { runtimePath: "/user-data/scoreko/nodecg", installed: false };
|
||||
},
|
||||
relaunch: () => events.push("relaunch"),
|
||||
scheduleUpdateCheck: () => events.push("schedule-update"),
|
||||
setAppUserModelId: () => events.push("set-app-user-model-id"),
|
||||
exit: (code) => events.push(`exit:${code}`),
|
||||
@@ -145,7 +144,7 @@ test("ApplicationController preserves startup ordering and schedules updates aft
|
||||
]);
|
||||
});
|
||||
|
||||
test("ApplicationController relaunches packaged app after runtime install before starting NodeCG", async () => {
|
||||
test("ApplicationController directly launches packaged app after runtime install without relaunching", async () => {
|
||||
const events: string[] = [];
|
||||
const controller = createApplicationController({
|
||||
appConfig: getBaseConfig(),
|
||||
@@ -162,31 +161,45 @@ test("ApplicationController relaunches packaged app after runtime install before
|
||||
},
|
||||
deps: {
|
||||
createLoadingWindow: () => {
|
||||
throw new Error("window creation should wait until after relaunch decisions");
|
||||
events.push("create-loading");
|
||||
return new MockWindow("loading", events);
|
||||
},
|
||||
createMainWindow: () => {
|
||||
throw new Error("window creation should wait until after relaunch decisions");
|
||||
events.push("create-main");
|
||||
return new MockWindow("main", events);
|
||||
},
|
||||
createNodecgProcessManager: () => {
|
||||
throw new Error("NodeCG should not start before relaunch");
|
||||
events.push("create-manager");
|
||||
return createMockManager(events);
|
||||
},
|
||||
getAllWindows: () => [],
|
||||
log: (...args) => events.push(String(args[0])),
|
||||
prepareRuntime: () => ({ runtimePath: "/user-data/scoreko/nodecg", installed: true }),
|
||||
relaunch: () => events.push("relaunch"),
|
||||
scheduleUpdateCheck: () => events.push("schedule-update"),
|
||||
setAppUserModelId: () => events.push("set-app-user-model-id"),
|
||||
exit: (code) => events.push(`exit:${code}`),
|
||||
now: () => 0,
|
||||
sleep: async (ms) => {
|
||||
events.push(`sleep:${ms}`);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await controller.launch();
|
||||
|
||||
assert.equal(controller.getState(), "stopped");
|
||||
assert.equal(controller.getState(), "ready");
|
||||
assert.deepEqual(events, [
|
||||
"Runtime was installed or refreshed; relaunching Scoreko before starting NodeCG.",
|
||||
"relaunch",
|
||||
"exit:0",
|
||||
"create-manager",
|
||||
"create-main",
|
||||
"create-loading",
|
||||
"start-nodecg",
|
||||
"wait-nodecg",
|
||||
"loading:load:http://localhost:9090/loading",
|
||||
"loading:show",
|
||||
"main:load:http://localhost:9090/main",
|
||||
"main:show",
|
||||
"loading:close",
|
||||
"schedule-update",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -215,7 +228,6 @@ test("ApplicationController activation before readiness routes through launch",
|
||||
events.push("prepare-runtime");
|
||||
return { runtimePath: "/user-data/scoreko/nodecg", installed: false };
|
||||
},
|
||||
relaunch: () => events.push("relaunch"),
|
||||
scheduleUpdateCheck: () => events.push("schedule-update"),
|
||||
setAppUserModelId: () => events.push("set-app-user-model-id"),
|
||||
exit: (code) => events.push(`exit:${code}`),
|
||||
@@ -253,7 +265,6 @@ test("ApplicationController shutdown is idempotent", async () => {
|
||||
getAllWindows: () => [],
|
||||
log: () => undefined,
|
||||
prepareRuntime: () => ({ runtimePath: "/user-data/scoreko/nodecg", installed: false }),
|
||||
relaunch: () => events.push("relaunch"),
|
||||
scheduleUpdateCheck: () => events.push("schedule-update"),
|
||||
setAppUserModelId: () => events.push("set-app-user-model-id"),
|
||||
exit: (code) => events.push(`exit:${code}`),
|
||||
|
||||
Reference in New Issue
Block a user