fix: handle lazy startup failures

This commit is contained in:
ajnart committed 2026-07-29 07:23:09 +02:00
1 parent 84f87ce24e
commit c80e9878de
5 files changed
+85 -21

No files matched your search

+18
View File
@@ -52,4 +52,22 @@ describe("Next instrumentation", () => {
expect(tasksStarted).not.toHaveBeenCalled();
expect(websocketStarted).not.toHaveBeenCalled();
});
test("isolates embedded service startup failures", async () => {
const websocketStarted = vi.fn();
vi.stubEnv("NODE_ENV", "production");
vi.stubEnv("NEXT_RUNTIME", "nodejs");
vi.doMock("@homarr/tasks", () => {
throw new Error("task startup failed");
});
vi.doMock("@homarr/websocket", () => {
websocketStarted();
return {};
});
const { register } = await import("./instrumentation");
await expect(register()).resolves.toBeUndefined();
expect(websocketStarted).toHaveBeenCalledOnce();
});
});