huskies: merge 1120 story Silence intentional-error stderr in frontend tests so failures stand out
This commit is contained in:
@@ -160,6 +160,7 @@ describe("App", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("shows error when openProject fails", async () => {
|
it("shows error when openProject fails", async () => {
|
||||||
|
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||||
mockedApi.openProject.mockRejectedValue(new Error("Path does not exist"));
|
mockedApi.openProject.mockRejectedValue(new Error("Path does not exist"));
|
||||||
|
|
||||||
await renderApp();
|
await renderApp();
|
||||||
@@ -182,6 +183,7 @@ describe("App", () => {
|
|||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByText(/Path does not exist/)).toBeInTheDocument();
|
expect(screen.getByText(/Path does not exist/)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
errorSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows known projects list", async () => {
|
it("shows known projects list", async () => {
|
||||||
|
|||||||
@@ -266,6 +266,8 @@ describe("subscribeAgentStream", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("handles malformed JSON without throwing", () => {
|
it("handles malformed JSON without throwing", () => {
|
||||||
|
vi.spyOn(console, "error").mockImplementation(() => {});
|
||||||
|
|
||||||
subscribeAgentStream("42_story_test", "coder", vi.fn());
|
subscribeAgentStream("42_story_test", "coder", vi.fn());
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
|
|||||||
@@ -472,9 +472,16 @@ describe("Slash command handling (Story 374)", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Story 1058: WebSocket errors do not appear in chat", () => {
|
describe("Story 1058: WebSocket errors do not appear in chat", () => {
|
||||||
|
let consoleSpy: ReturnType<typeof vi.spyOn>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
capturedWsHandlers = null;
|
capturedWsHandlers = null;
|
||||||
setupMocks();
|
setupMocks();
|
||||||
|
consoleSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
consoleSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not add a chat message when onError is called", async () => {
|
it("does not add a chat message when onError is called", async () => {
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ describe("usePathCompletion hook", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("sets completionError when listDirectoryAbsolute throws an Error", async () => {
|
it("sets completionError when listDirectoryAbsolute throws an Error", async () => {
|
||||||
|
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||||
mockListDir.mockRejectedValue(new Error("Permission denied"));
|
mockListDir.mockRejectedValue(new Error("Permission denied"));
|
||||||
|
|
||||||
const { result } = renderHook(() =>
|
const { result } = renderHook(() =>
|
||||||
@@ -242,9 +243,13 @@ describe("usePathCompletion hook", () => {
|
|||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(result.current.completionError).toBe("Permission denied");
|
expect(result.current.completionError).toBe("Permission denied");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(errorSpy).toHaveBeenCalledWith(new Error("Permission denied"));
|
||||||
|
errorSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sets generic completionError when listDirectoryAbsolute throws a non-Error", async () => {
|
it("sets generic completionError when listDirectoryAbsolute throws a non-Error", async () => {
|
||||||
|
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
||||||
mockListDir.mockRejectedValue("some string error");
|
mockListDir.mockRejectedValue("some string error");
|
||||||
|
|
||||||
const { result } = renderHook(() =>
|
const { result } = renderHook(() =>
|
||||||
@@ -262,6 +267,9 @@ describe("usePathCompletion hook", () => {
|
|||||||
"Failed to compute suggestion.",
|
"Failed to compute suggestion.",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(errorSpy).toHaveBeenCalledWith("some string error");
|
||||||
|
errorSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("clears suggestionTail when selected match path does not start with input", async () => {
|
it("clears suggestionTail when selected match path does not start with input", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user