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.
This commit is contained in:
@@ -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"
|
import type { LegacyPluginCheckResult } from "./legacy-plugin-warning"
|
||||||
|
|
||||||
function createLegacyPluginCheckResult(
|
function createLegacyPluginCheckResult(
|
||||||
@@ -24,6 +24,10 @@ mock.module("./logger", () => ({
|
|||||||
log: mockLog,
|
log: mockLog,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
mock.restore()
|
||||||
|
})
|
||||||
|
|
||||||
async function importFreshStartupWarningModule(): Promise<typeof import("./log-legacy-plugin-startup-warning")> {
|
async function importFreshStartupWarningModule(): Promise<typeof import("./log-legacy-plugin-startup-warning")> {
|
||||||
return import(`./log-legacy-plugin-startup-warning?test=${Date.now()}-${Math.random()}`)
|
return import(`./log-legacy-plugin-startup-warning?test=${Date.now()}-${Math.random()}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
// 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)
|
// Without this, findProviderModelMetadata reads real cached model metadata (e.g., from opencode serve)
|
||||||
@@ -10,6 +10,10 @@ mock.module("./connected-providers-cache", () => ({
|
|||||||
hasProviderModelsCache: () => false,
|
hasProviderModelsCache: () => false,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
mock.restore()
|
||||||
|
})
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getModelCapabilities,
|
getModelCapabilities,
|
||||||
getBundledModelCapabilitiesSnapshot,
|
getBundledModelCapabilitiesSnapshot,
|
||||||
|
|||||||
Reference in New Issue
Block a user