refactor: 统一 log.ts/debug.ts 的测试 mock 为共享定义

- 新增 tests/mocks/log.ts 和 tests/mocks/debug.ts,覆盖源文件全部实际导出
- 移除旧 mock 中不存在的导出(logToFile、logEvent、getLogFilePath)
- 13 个测试文件改为使用共享 mock,避免定义分散和不一致

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-22 23:35:59 +08:00
parent dceaacdf4f
commit 1a910ed639
16 changed files with 87 additions and 134 deletions

View File

@@ -1,20 +1,8 @@
import { mock, describe, expect, test } from "bun:test";
import { debugMock } from "../../../tests/mocks/debug";
// Mock debug.ts to cut bootstrap/state dependency chain
mock.module("src/utils/debug.ts", () => ({
logForDebugging: () => {},
isDebugMode: () => false,
isDebugToStdErr: () => false,
getDebugFilePath: () => null,
getDebugFilter: () => null,
getMinDebugLogLevel: () => "debug",
getDebugLogPath: () => "/tmp/mock-debug.log",
flushDebugLogs: async () => {},
enableDebugLogging: () => false,
setHasFormattedOutput: () => {},
getHasFormattedOutput: () => false,
logAntError: () => {},
}));
mock.module("src/utils/debug.ts", debugMock);
const { validateBoundedIntEnvVar } = await import("../envValidation");