test: run suite through isolated mock runner
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
@@ -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")
|
||||
})
|
||||
})
|
||||
@@ -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
@@ -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
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user