7a1f121fdd
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.
33 lines
1.0 KiB
TypeScript
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)
|
|
})
|
|
})
|