From 179ad05f5f92cea7e254ae3bd6bf30c18a7542a2 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 4 Apr 2026 17:17:06 +0900 Subject: [PATCH] fix(test): silence expected oauth logout cli output Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/cli/mcp-oauth/logout.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cli/mcp-oauth/logout.test.ts b/src/cli/mcp-oauth/logout.test.ts index b3d042a65..691cef5d9 100644 --- a/src/cli/mcp-oauth/logout.test.ts +++ b/src/cli/mcp-oauth/logout.test.ts @@ -1,4 +1,4 @@ -import { describe, it, expect, beforeEach, afterEach, mock } from "bun:test" +import { afterEach, beforeEach, describe, expect, it, spyOn } from "bun:test" import { existsSync, mkdirSync, rmSync } from "node:fs" import { join } from "node:path" import { tmpdir } from "node:os" @@ -9,10 +9,14 @@ const { logout } = await import("./logout") describe("logout command", () => { const TEST_CONFIG_DIR = join(tmpdir(), "mcp-oauth-logout-test-" + Date.now()) let originalConfigDir: string | undefined + let consoleErrorSpy: ReturnType + let consoleLogSpy: ReturnType beforeEach(() => { originalConfigDir = process.env.OPENCODE_CONFIG_DIR process.env.OPENCODE_CONFIG_DIR = TEST_CONFIG_DIR + consoleErrorSpy = spyOn(console, "error").mockImplementation(() => {}) + consoleLogSpy = spyOn(console, "log").mockImplementation(() => {}) if (!existsSync(TEST_CONFIG_DIR)) { mkdirSync(TEST_CONFIG_DIR, { recursive: true }) } @@ -27,6 +31,8 @@ describe("logout command", () => { if (existsSync(TEST_CONFIG_DIR)) { rmSync(TEST_CONFIG_DIR, { recursive: true, force: true }) } + consoleErrorSpy.mockRestore() + consoleLogSpy.mockRestore() }) it("returns success code when logout succeeds", async () => {