fix(tests): resolve 6 test isolation failures in full suite
3 failures in fallback.cliproxyapi-matrix.test.ts: - Root cause: leaked spyOn(getMainSessionID) in tool-execute-before-session-notification.test.ts was never restored, poisoning module state for subsequent tests in the same worker - Added mockRestore() call and _resetModelFallbackForTesting in afterEach 3 failures in background-agent/manager.test.ts: - Root cause: connected-providers-cache memConnected/memProviderModels persisted across test files, making isReachable() skip fallback candidates in retry tests - Added mock.module for connected-providers-cache at file level - Added _resetMemCacheForTesting export and global beforeEach cleanup Full suite: 4638/4638 pass, 0 fail
This commit is contained in:
@@ -1,5 +1,15 @@
|
||||
declare const require: (name: string) => any
|
||||
const { describe, test, expect, beforeEach, afterEach, spyOn } = require("bun:test")
|
||||
const { describe, test, expect, beforeEach, afterEach, spyOn, mock } = require("bun:test")
|
||||
|
||||
mock.module("../../shared/connected-providers-cache", () => ({
|
||||
readConnectedProvidersCache: () => null,
|
||||
readProviderModelsCache: () => null,
|
||||
hasConnectedProvidersCache: () => false,
|
||||
hasProviderModelsCache: () => false,
|
||||
writeProviderModelsCache: () => {},
|
||||
updateConnectedProvidersCache: () => {},
|
||||
}))
|
||||
|
||||
import { getSessionPromptParams, clearSessionPromptParams } from "../../shared/session-prompt-params-state"
|
||||
import { tmpdir } from "node:os"
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
|
||||
Reference in New Issue
Block a user