mirror of
https://github.com/Pandipipas/scoreko-electron-dev.git
synced 2026-06-06 05:32:06 +00:00
fix(nodecg): include actionable diagnostics when process exits before readiness (#27)
This commit is contained in:
@@ -236,3 +236,46 @@ test("startNodeCG falla si el puerto ya está ocupado", async () => {
|
||||
await manager.startNodecgProcess();
|
||||
}, /ya está en uso/);
|
||||
});
|
||||
|
||||
test("waitForNodeCGReady expone diagnóstico cuando NodeCG sale antes de readiness", async () => {
|
||||
const child = new MockChildProcess(4242);
|
||||
const manager = createNodecgProcessManager({
|
||||
isDev: true,
|
||||
nodecgRootPath: "/fake/nodecg",
|
||||
nodecgBaseUrl: "http://127.0.0.1:9090",
|
||||
appConfig: getBaseConfig(),
|
||||
log: () => undefined,
|
||||
deps: {
|
||||
pathExists: () => true,
|
||||
platform: "linux",
|
||||
spawnProcess: () => child as unknown as import("node:child_process").ChildProcess,
|
||||
fetchUrl: async () => {
|
||||
child.emit("exit", 1, null);
|
||||
throw new Error("still starting");
|
||||
},
|
||||
setTimer: (handler) => {
|
||||
handler();
|
||||
return 0;
|
||||
},
|
||||
stdoutWrite: () => undefined,
|
||||
stderrWrite: () => undefined,
|
||||
probePortAvailable: async () => true,
|
||||
hasReadWriteAccess: () => true,
|
||||
},
|
||||
});
|
||||
|
||||
await manager.startNodecgProcess();
|
||||
|
||||
await assert.rejects(
|
||||
async () => {
|
||||
await manager.waitForNodecgReady(Date.now());
|
||||
},
|
||||
(error: unknown) => {
|
||||
assert.ok(error instanceof Error);
|
||||
assert.match(error.message, /NodeCG terminó antes de estar listo/);
|
||||
assert.match(error.message, /Última salida registrada/);
|
||||
assert.match(error.message, /Ruta NodeCG: \/fake\/nodecg/);
|
||||
return true;
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user