From 9daaeedc507761ac68a88c2add5805fa64d2d7e6 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 27 Mar 2026 00:08:20 +0900 Subject: [PATCH] fix(test): restore shared Bun mocks after suite cleanup Prevent src/shared batch runs from leaking module mocks into later files, which was breaking Linux CI cache metadata and legacy plugin warning assertions. --- src/shared/log-legacy-plugin-startup-warning.test.ts | 6 +++++- src/shared/model-capabilities.test.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/shared/log-legacy-plugin-startup-warning.test.ts b/src/shared/log-legacy-plugin-startup-warning.test.ts index f4a23786c..5259515b8 100644 --- a/src/shared/log-legacy-plugin-startup-warning.test.ts +++ b/src/shared/log-legacy-plugin-startup-warning.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, expect, it, mock } from "bun:test" +import { afterAll, beforeEach, describe, expect, it, mock } from "bun:test" import type { LegacyPluginCheckResult } from "./legacy-plugin-warning" function createLegacyPluginCheckResult( @@ -24,6 +24,10 @@ mock.module("./logger", () => ({ log: mockLog, })) +afterAll(() => { + mock.restore() +}) + async function importFreshStartupWarningModule(): Promise { return import(`./log-legacy-plugin-startup-warning?test=${Date.now()}-${Math.random()}`) } diff --git a/src/shared/model-capabilities.test.ts b/src/shared/model-capabilities.test.ts index 8532ace04..80747e333 100644 --- a/src/shared/model-capabilities.test.ts +++ b/src/shared/model-capabilities.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test, mock } from "bun:test" +import { afterAll, describe, expect, test, mock } from "bun:test" // Mock connected-providers-cache to prevent local disk cache from polluting test results. // Without this, findProviderModelMetadata reads real cached model metadata (e.g., from opencode serve) @@ -10,6 +10,10 @@ mock.module("./connected-providers-cache", () => ({ hasProviderModelsCache: () => false, })) +afterAll(() => { + mock.restore() +}) + import { getModelCapabilities, getBundledModelCapabilitiesSnapshot,