fix: exit message cli on plugin preload failure

This commit is contained in:
Peter Steinberger
2026-05-03 18:27:26 +01:00
parent 9d858a401d
commit 95b67ea9ba
3 changed files with 17 additions and 2 deletions
+14
View File
@@ -136,6 +136,20 @@ describe("runMessageAction", () => {
});
});
it("exits with failure when plugin registry loading fails before dispatch", async () => {
vi.mocked(ensurePluginRegistryLoaded).mockImplementationOnce(() => {
throw new Error("plugin load failed");
});
await runSendAction();
expect(messageCommandMock).not.toHaveBeenCalled();
expect(errorMock).toHaveBeenCalledWith("Error: plugin load failed");
expect(exitMock).toHaveBeenCalledOnce();
expect(exitMock).toHaveBeenCalledWith(1);
expect(exitMock).not.toHaveBeenCalledWith(0);
});
it("runs gateway_stop hooks before exit when registered", async () => {
hasHooksMock.mockReturnValueOnce(true);
await runSendAction();