дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
Broadcasts called their listeners in a bare loop, so one throwing handler kept the rest (including the catch-all "*" IDE event handlers) from seeing the event. The IDE event bus, local diagnostics, endpoint-change and navigation-modifier broadcasts now go through `notifyEach`, which logs a throwing listener and moves on. `onIdeEvent` wraps each subscription so unsubscribing one of two identical handlers keeps the other. Co-authored-by: rohitdanda <[email protected]>
23 рядки
691 B
TypeScript
23 рядки
691 B
TypeScript
import { afterEach, expect, it, vi } from "vitest";
|
|
import { onLocalDiagnostics, publishLocalDiagnostics } from "./localDiagnostics";
|
|
|
|
afterEach(() => vi.restoreAllMocks());
|
|
|
|
it("keeps notifying local diagnostics listeners after one throws", () => {
|
|
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
const second = vi.fn();
|
|
const offs = [
|
|
onLocalDiagnostics(() => {
|
|
throw new Error("boom");
|
|
}),
|
|
onLocalDiagnostics(second),
|
|
];
|
|
try {
|
|
publishLocalDiagnostics("/p/a.sql", "sql", []);
|
|
} finally {
|
|
offs.forEach((off) => off());
|
|
}
|
|
expect(second).toHaveBeenCalledWith("/p/a.sql", "sql", []);
|
|
expect(error).toHaveBeenCalledOnce();
|
|
});
|