test: run suite through isolated mock runner

This commit is contained in:
YeonGyu-Kim
2026-05-12 15:30:45 +09:00
parent cde14b5e37
commit 4150092e9a
5 changed files with 29 additions and 6 deletions
+1 -1
View File
@@ -34,7 +34,7 @@
"prepublishOnly": "bun run clean && bun run build",
"test:model-capabilities": "bun test src/shared/model-capability-aliases.test.ts src/shared/model-capability-guardrails.test.ts src/shared/model-capabilities.test.ts src/cli/doctor/checks/model-resolution.test.ts --bail",
"typecheck": "tsc --noEmit",
"test": "bun test bin script src"
"test": "bun run script/run-ci-tests.ts"
},
"keywords": [
"opencode",
+11
View File
@@ -0,0 +1,11 @@
import { describe, expect, test } from "bun:test"
describe("test script isolation", () => {
test("#given mock.module tests in the suite #then bun run test uses the isolated CI runner", async () => {
//#given
const packageJson = await Bun.file("package.json").json()
//#then
expect(packageJson.scripts.test).toBe("bun run script/run-ci-tests.ts")
})
})
+6 -2
View File
@@ -38,11 +38,15 @@ function installModuleMocks(): void {
detectExternalSkillPlugin: mock(() => ({ detected: false, pluginName: null })),
getSkillPluginConflictWarning: mock(() => ""),
}))
mock.module("./shared", () => ({
injectServerAuthIntoClient: mockInjectServerAuthIntoClient,
mock.module("./shared/logger", () => ({
log: mock(() => {}),
}))
mock.module("./shared/log-legacy-plugin-startup-warning", () => ({
logLegacyPluginStartupWarning: mockLogLegacyPluginStartupWarning,
}))
mock.module("./shared/opencode-server-auth", () => ({
injectServerAuthIntoClient: mockInjectServerAuthIntoClient,
}))
mock.module("./plugin-config", () => ({
loadPluginConfig: mockLoadPluginConfig,
}))
+8 -2
View File
@@ -52,12 +52,18 @@ function installIndexModuleMocks(): void {
getSkillPluginConflictWarning: mockGetSkillPluginConflictWarning,
}))
mock.module("./shared", () => ({
injectServerAuthIntoClient: mockInjectServerAuthIntoClient,
mock.module("./shared/logger", () => ({
log: mock(() => {}),
}))
mock.module("./shared/log-legacy-plugin-startup-warning", () => ({
logLegacyPluginStartupWarning: mockLogLegacyPluginStartupWarning,
}))
mock.module("./shared/opencode-server-auth", () => ({
injectServerAuthIntoClient: mockInjectServerAuthIntoClient,
}))
mock.module("./plugin-config", () => ({
loadPluginConfig: mockLoadPluginConfig,
}))
+3 -1
View File
@@ -18,7 +18,9 @@ import {
import { loadPluginConfig } from "./plugin-config"
import { createModelCacheState } from "./plugin-state"
import { createFirstMessageVariantGate } from "./shared/first-message-variant"
import { injectServerAuthIntoClient, log, logLegacyPluginStartupWarning } from "./shared"
import { log } from "./shared/logger"
import { logLegacyPluginStartupWarning } from "./shared/log-legacy-plugin-startup-warning"
import { injectServerAuthIntoClient } from "./shared/opencode-server-auth"
import { installAgentSortShim, setAgentSortOrder } from "./shared/agent-sort-shim"
import { detectExternalSkillPlugin, getSkillPluginConflictWarning } from "./shared/external-plugin-detector"
import { startBackgroundCheck as startTmuxCheck } from "./tools/interactive-bash"