From fb7e3fd98d02c33a763c3e335fb53247cb044558 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 4 Apr 2026 17:17:01 +0900 Subject: [PATCH] fix(test): silence expected oauth login cli output Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/cli/mcp-oauth/login.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli/mcp-oauth/login.test.ts b/src/cli/mcp-oauth/login.test.ts index 12925b7fe..8f6c23076 100644 --- a/src/cli/mcp-oauth/login.test.ts +++ b/src/cli/mcp-oauth/login.test.ts @@ -1,4 +1,4 @@ -import { afterAll, describe, it, expect, beforeEach, afterEach, mock } from "bun:test" +import { afterAll, afterEach, beforeEach, describe, expect, it, mock, spyOn } from "bun:test" const mockLogin = mock(() => Promise.resolve({ accessToken: "test-token", expiresAt: 1710000000 })) @@ -18,12 +18,18 @@ afterAll(() => { const { login } = await import("./login") describe("login command", () => { + let consoleErrorSpy: ReturnType + let consoleLogSpy: ReturnType + beforeEach(() => { mockLogin.mockClear() + consoleErrorSpy = spyOn(console, "error").mockImplementation(() => {}) + consoleLogSpy = spyOn(console, "log").mockImplementation(() => {}) }) afterEach(() => { - // cleanup + consoleErrorSpy.mockRestore() + consoleLogSpy.mockRestore() }) it("returns error code when server-url is not provided", async () => {