Files
oh-my-opencode/src/shared/model-resolution-pipeline.test.ts
T
YeonGyu-Kim 7a1f121fdd fix(ci): isolate model-resolution-pipeline test to prevent mock contamination
The resolveModelPipeline test was consistently failing on CI
(resolveModelPipeline > does not return unused explicit user config
metadata in override result) while passing locally. Root cause is the
same mock.module contamination pattern as #3243: when bun runs all test
files in a single process, mock.module calls from other files (e.g.
model-resolver.test.ts) leak into this file's module scope.

Add mock.module('./logger', ...) so run-ci-tests.ts auto-detects the
file and runs it in its own isolated bun process.

This unblocks the v3.16.1 publish workflow which hit this flake twice.
2026-04-09 14:19:17 +09:00

33 lines
1.0 KiB
TypeScript

import { describe, expect, mock, test } from "bun:test"
import { resolveModelPipeline } from "./model-resolution-pipeline"
// Force test-runner isolation: files that import mock.module are auto-detected
// by run-ci-tests.ts and executed in their own bun process so they cannot be
// contaminated by (or contaminate) mock.module calls in other test files.
mock.module("./logger", () => ({
log: () => {},
}))
describe("resolveModelPipeline", () => {
test("does not return unused explicit user config metadata in override result", () => {
// given
const result = resolveModelPipeline({
intent: {
userModel: "openai/gpt-5.3-codex",
},
constraints: {
availableModels: new Set<string>(),
},
})
// when
const hasExplicitUserConfigField = result
? Object.prototype.hasOwnProperty.call(result, "explicitUserConfig")
: false
// then
expect(result).toEqual({ model: "openai/gpt-5.3-codex", provenance: "override" })
expect(hasExplicitUserConfigField).toBe(false)
})
})